public LocalRoute(InterfaceAddress interfaceAddress, String nextHopInterface) { this( Prefix.create(interfaceAddress.getIp(), Prefix.MAX_PREFIX_LENGTH), nextHopInterface, interfaceAddress.getNetworkBits(), 0); }
@Override public IpSpace visitInterfaceLinkLocation(InterfaceLinkLocation interfaceLinkLocation) { String node = interfaceLinkLocation.getNodeName(); String iface = interfaceLinkLocation.getInterfaceName(); @Nullable IpSpace linkIpSpace = AclIpSpace.union( interfaceAddresses(node, iface).stream() /* * Only include addresses on networks that might have hosts. */ .filter(address -> address.getNetworkBits() <= HOST_SUBNET_MAX_PREFIX_LENGTH) .map(address -> address.getPrefix().toHostIpSpace()) .collect(Collectors.toList())); return linkIpSpace == null ? EmptyIpSpace.INSTANCE : AclIpSpace.difference(linkIpSpace, _specifierContext.getSnapshotDeviceOwnedIps()); }
/** * Initialize the local RIB -- a RIB containing non-forwarding /32 routes for exact addresses of * interfaces */ @VisibleForTesting void initLocalRib() { // Look at all connected interfaces for (Interface i : _vrf.getInterfaces().values()) { if (i.getActive()) { // Make sure the interface is active // Create a route for each interface prefix for (InterfaceAddress ifaceAddress : i.getAllAddresses()) { if (ifaceAddress.getNetworkBits() < Prefix.MAX_PREFIX_LENGTH) { LocalRoute lr = new LocalRoute(ifaceAddress, i.getName()); _localRib.mergeRoute(lr); } } } } }
@Override public void exitIfiav_virtual_address(Ifiav_virtual_addressContext ctx) { Ip virtualAddress = Ip.parse(ctx.IP_ADDRESS().getText()); int prefixLength = _currentInterfaceAddress.getNetworkBits(); _currentVrrpGroup.setVirtualAddress(new InterfaceAddress(virtualAddress, prefixLength)); }
.put(COL_INTERFACE_NAME, iface.getName()) .put(COL_IP, address.getIp()) .put(COL_MASK, address.getNetworkBits()) .put(COL_ACTIVE, iface.getActive()) .build());
if (address.getNetworkBits() < Prefix.MAX_PREFIX_LENGTH) { Prefix prefix = address.getPrefix(); List<Interface> interfaceBucket =
ConnectedRoute route = new ConnectedRoute( Prefix.create(address.getIp(), address.getNetworkBits()), interfaceName); for (RoutingPolicy exportPolicy : exportPolicies) { if (exportPolicy.process(
@Override public void exitIf_ip_address(If_ip_addressContext ctx) { InterfaceAddress address; if (ctx.prefix != null) { address = new InterfaceAddress(ctx.prefix.getText()); } else { Ip ip = toIp(ctx.ip); Ip mask = toIp(ctx.subnet); address = new InterfaceAddress(ip, mask); } for (Interface currentInterface : _currentInterfaces) { currentInterface.setAddress(address); } if (ctx.STANDBY() != null) { Ip standbyIp = toIp(ctx.standby_address); InterfaceAddress standbyAddress = new InterfaceAddress(standbyIp, address.getNetworkBits()); for (Interface currentInterface : _currentInterfaces) { currentInterface.setStandbyAddress(standbyAddress); } } }
ConnectedRoute route = new ConnectedRoute( Prefix.create(address.getIp(), address.getNetworkBits()), interfaceName); if (exportPolicy.process(
InterfaceAddress ifaceAddress = iface.getAddress(); if (ifaceAddress != null) { int prefixLength = ifaceAddress.getNetworkBits(); Ip address = vrrpGroup.getVirtualAddress(); if (address != null) {