org.onlab.packet.IpPrefix Java Examples
The following examples show how to use
org.onlab.packet.IpPrefix.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultFlowClassifier.java From onos with Apache License 2.0 | 6 votes |
/** * Constructor to create default flow classifier. * * @param flowClassifierId flow classifier Id * @param tenantId Tenant ID * @param name flow classifier name * @param description flow classifier description * @param etherType etherType * @param protocol IP protocol * @param priority priority for classification * @param minSrcPortRange Minimum Source port range * @param maxSrcPortRange Maximum Source port range * @param minDstPortRange Minimum destination port range * @param maxDstPortRange Maximum destination port range * @param srcIpPrefix Source IP prefix * @param dstIpPrefix destination IP prefix * @param srcPort Source VirtualPort * @param dstPort destination VirtualPort */ private DefaultFlowClassifier(FlowClassifierId flowClassifierId, TenantId tenantId, String name, String description, String etherType, String protocol, int priority, int minSrcPortRange, int maxSrcPortRange, int minDstPortRange, int maxDstPortRange, IpPrefix srcIpPrefix, IpPrefix dstIpPrefix, VirtualPortId srcPort, VirtualPortId dstPort) { this.flowClassifierId = flowClassifierId; this.tenantId = tenantId; this.name = name; this.description = description; this.etherType = etherType; this.protocol = protocol; this.priority = priority; this.minSrcPortRange = minSrcPortRange; this.maxSrcPortRange = maxSrcPortRange; this.minDstPortRange = minDstPortRange; this.maxDstPortRange = maxDstPortRange; this.srcIpPrefix = srcIpPrefix; this.dstIpPrefix = dstIpPrefix; this.srcPort = srcPort; this.dstPort = dstPort; }
Example #2
Source File: EvpnRouteTable.java From onos with Apache License 2.0 | 6 votes |
private ConsistentMap<EvpnPrefix, Set<EvpnRoute>> buildRouteMap(StorageService storageService) { KryoNamespace routeTableSerializer = KryoNamespace.newBuilder() .register(KryoNamespaces.API) .register(KryoNamespaces.MISC) .register(EvpnRoute.class) .register(EvpnPrefix.class) .register(RouteDistinguisher.class) .register(MacAddress.class) .register(IpPrefix.class) .register(EvpnRoute.Source.class) .register(IpAddress.class) .register(VpnRouteTarget.class) .register(Label.class) .register(EvpnRouteTableId.class) .build(); return storageService.<EvpnPrefix, Set<EvpnRoute>>consistentMapBuilder() .withName("onos-evpn-routes-" + id.name()) .withRelaxedReadConsistency() .withSerializer(Serializer.using(routeTableSerializer)) .build(); }
Example #3
Source File: SubnetCreateCommand.java From onos with Apache License 2.0 | 6 votes |
@Override protected void doExecute() { SubnetService service = get(SubnetService.class); if (id == null || networkId == null || tenantId == null) { print("id,networkId,tenantId can not be null"); return; } Subnet subnet = new DefaultSubnet(SubnetId.subnetId(id), subnetName, TenantNetworkId.networkId(networkId), TenantId.tenantId(tenantId), ipVersion, cidr == null ? null : IpPrefix.valueOf(cidr), gatewayIp == null ? null : IpAddress.valueOf(gatewayIp), dhcpEnabled, shared, hostRoutes, ipV6AddressMode == null ? null : Mode.valueOf(ipV6AddressMode), ipV6RaMode == null ? null : Mode.valueOf(ipV6RaMode), allocationPools); Set<Subnet> subnetsSet = Sets.newHashSet(subnet); service.createSubnets(subnetsSet); }
Example #4
Source File: TelemetryVflowAddCommand.java From onos with Apache License 2.0 | 6 votes |
@Override protected void doExecute() { StatsFlowRuleAdminService statsService = get(StatsFlowRuleAdminService.class); StatsFlowRule statsFlowRule = DefaultStatsFlowRule.builder() .srcIpPrefix(IpPrefix.valueOf(srcIp)) .dstIpPrefix(IpPrefix.valueOf(dstIp)) .srcTpPort(TpPort.tpPort(Integer.valueOf(srcTpPort))) .dstTpPort(TpPort.tpPort(Integer.valueOf(dstTpPort))) .ipProtocol(getProtocolTypeFromString(ipProto)) .build(); statsService.createStatFlowRule(statsFlowRule); print("Added the stat flow rule."); }
Example #5
Source File: SdnIpFib.java From onos with Apache License 2.0 | 6 votes |
private void update(ResolvedRoute route) { synchronized (this) { IpPrefix prefix = route.prefix(); EncapsulationType encap = encap(); MultiPointToSinglePointIntent intent = generateRouteIntent(prefix, route.nextHop(), route.nextHopMac(), encap); if (intent == null) { log.debug("No interface found for route {}", route); return; } routeIntents.put(prefix, intent); intentSynchronizer.submit(intent); } }
Example #6
Source File: DefaultFlowInfo.java From onos with Apache License 2.0 | 6 votes |
private DefaultFlowInfo(byte flowType, DeviceId deviceId, int inputInterfaceId, int outputInterfaceId, VlanId vlanId, short vxlanId, IpPrefix srcIp, IpPrefix dstIp, TpPort srcPort, TpPort dstPort, byte protocol, MacAddress srcMac, MacAddress dstMac, StatsInfo statsInfo) { this.flowType = flowType; this.deviceId = deviceId; this.inputInterfaceId = inputInterfaceId; this.outputInterfaceId = outputInterfaceId; this.vlanId = vlanId; this.vxlanId = vxlanId; this.srcIp = srcIp; this.dstIp = dstIp; this.srcPort = srcPort; this.dstPort = dstPort; this.protocol = protocol; this.srcMac = srcMac; this.dstMac = dstMac; this.statsInfo = statsInfo; }
Example #7
Source File: FibInstaller.java From onos with Apache License 2.0 | 6 votes |
private ForwardingObjective.Builder generateRibForwardingObj(IpPrefix prefix, Integer nextId) { TrafficSelector selector = buildIpSelectorFromIpPrefix(prefix).build(); int priority = prefix.prefixLength() * PRIORITY_MULTIPLIER + PRIORITY_OFFSET; ForwardingObjective.Builder fwdBuilder = DefaultForwardingObjective.builder() .fromApp(fibAppId) .makePermanent() .withSelector(selector) .withPriority(priority) .withFlag(ForwardingObjective.Flag.SPECIFIC); if (nextId == null) { // Route withdraws are not specified with next hops. Generating // dummy treatment as there is no equivalent nextId info. fwdBuilder.withTreatment(DefaultTrafficTreatment.builder().build()); } else { fwdBuilder.nextStep(nextId); } return fwdBuilder; }
Example #8
Source File: MappingEntryBuilderTest.java From onos with Apache License 2.0 | 6 votes |
private void testMapRecordConversion(LispMapRecord record) { MappingEntry mappingEntry = new MappingEntryBuilder(DEVICE_ID, record).build(); MappingKey key = mappingEntry.key(); MappingValue value = mappingEntry.value(); IPMappingAddress recordAddress = (IPMappingAddress) key.address(); assertThat(recordAddress.ip(), is(IpPrefix.valueOf(IP_RECORD_ADDRESS + "/" + IP_RECORD_MASK_LENGTH))); assertThat(value.action().type(), is(MappingAction.Type.NATIVE_FORWARD)); assertThat(value.treatments().size(), is(1)); MappingTreatment treatment = value.treatments().get(0); IPMappingAddress locatorAddress = (IPMappingAddress) treatment.address(); assertThat(locatorAddress.ip(), is(IpPrefix.valueOf(IPV4_ADDRESS_1 + "/" + IP_LOCATOR_MASK_LENGTH))); }
Example #9
Source File: K8sServiceHandler.java From onos with Apache License 2.0 | 5 votes |
private void setSrcDstCidrRules(DeviceId deviceId, String srcCidr, String dstCidr, String cidrClass, String segId, String shiftPrefix, String shiftType, int installTable, int transitTable, int priority, boolean install) { TrafficSelector selector = DefaultTrafficSelector.builder() .matchEthType(Ethernet.TYPE_IPV4) .matchIPSrc(IpPrefix.valueOf(srcCidr)) .matchIPDst(IpPrefix.valueOf(dstCidr)) .build(); TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); if (segId != null) { tBuilder.setTunnelId(Long.valueOf(segId)); } if (shiftPrefix != null && shiftType != null) { ExtensionTreatment loadTreatment = buildLoadExtension( deviceService.getDevice(deviceId), cidrClass, shiftType, shiftPrefix); tBuilder.extension(loadTreatment, deviceId); } tBuilder.transition(transitTable); k8sFlowRuleService.setRule( appId, deviceId, selector, tBuilder.build(), priority, installTable, install); }
Example #10
Source File: IpPrefixSerializer.java From onos with Apache License 2.0 | 5 votes |
@Override public void write(Kryo kryo, Output output, IpPrefix object) { byte[] octs = object.address().toOctets(); output.writeInt(octs.length); output.writeBytes(octs); output.writeInt(object.prefixLength()); }
Example #11
Source File: DeviceConfiguration.java From onos with Apache License 2.0 | 5 votes |
/** * Checks if the host IP is in any of the subnet defined in the router with the * device ID given. * * @param deviceId device identification of the router * @param hostIp host IP address to check * @return true if the given IP is within any of the subnet defined in the router, * false if no subnet is defined in the router or if the host is not * within any subnet defined in the router */ public boolean inSameSubnet(DeviceId deviceId, IpAddress hostIp) { Set<IpPrefix> subnets = getConfiguredSubnets(deviceId); if (subnets == null) { return false; } for (IpPrefix subnet: subnets) { // Exclude /0 since it is a special case used for default route if (subnet.prefixLength() != 0 && subnet.contains(hostIp)) { return true; } } return false; }
Example #12
Source File: DefaultMappingTreatmentTest.java From onos with Apache License 2.0 | 5 votes |
/** * Tests equals() method. */ @Test public void testEquals() { IpPrefix ip1 = IpPrefix.valueOf(IP_ADDRESS_1); MappingAddress address1 = MappingAddresses.ipv4MappingAddress(ip1); MappingTreatment treatment1 = DefaultMappingTreatment.builder() .withAddress(address1) .setUnicastPriority(10) .setUnicastWeight(10) .build(); MappingTreatment sameAsTreatment1 = DefaultMappingTreatment.builder() .withAddress(address1) .setUnicastPriority(10) .setUnicastWeight(10) .build(); IpPrefix ip2 = IpPrefix.valueOf(IP_ADDRESS_2); MappingAddress address2 = MappingAddresses.ipv4MappingAddress(ip2); MappingTreatment treatment2 = DefaultMappingTreatment.builder() .withAddress(address2) .setMulticastPriority(20) .setMulticastWeight(20) .build(); new EqualsTester() .addEqualityGroup(treatment1, sameAsTreatment1) .addEqualityGroup(treatment2) .testEquals(); }
Example #13
Source File: ControlPlaneRedirectManager.java From onos with Apache License 2.0 | 5 votes |
static TrafficSelector buildIPDstSelector(IpPrefix dstIp, PortNumber inPort, MacAddress srcMac, MacAddress dstMac, VlanId vlanId) { TrafficSelector.Builder selector = buildBaseSelectorBuilder(inPort, srcMac, dstMac, vlanId); if (dstIp.isIp4()) { selector.matchEthType(TYPE_IPV4); selector.matchIPDst(dstIp); } else { selector.matchEthType(TYPE_IPV6); selector.matchIPv6Dst(dstIp); } return selector.build(); }
Example #14
Source File: Ipv6RoutingComponent.java From ngsdn-tutorial with Apache License 2.0 | 5 votes |
/** * Returns the set of interface IPv6 subnets (prefixes) configured for the * given device. * * @param deviceId the device ID * @return set of IPv6 prefixes */ private Set<Ip6Prefix> getInterfaceIpv6Prefixes(DeviceId deviceId) { return interfaceService.getInterfaces().stream() .filter(iface -> iface.connectPoint().deviceId().equals(deviceId)) .map(Interface::ipAddressesList) .flatMap(Collection::stream) .map(InterfaceIpAddress::subnetAddress) .filter(IpPrefix::isIp6) .map(IpPrefix::getIp6Prefix) .collect(Collectors.toSet()); }
Example #15
Source File: MockDefaultRoutingHandler.java From onos with Apache License 2.0 | 5 votes |
MockDefaultRoutingHandler(SegmentRoutingManager srManager, Map<ConnectPoint, Set<IpPrefix>> subnetTable, Map<MockRoutingTableKey, MockRoutingTableValue> routingTable) { super(srManager); this.subnetTable = subnetTable; this.routingTable = routingTable; }
Example #16
Source File: FpmRecord.java From onos with Apache License 2.0 | 5 votes |
public FpmRecord(IpPrefix prefix, IpAddress nextHop, Type type) { checkNotNull(prefix, "prefix cannot be null"); checkNotNull(nextHop, "ipAddress cannot be null"); this.prefix = prefix; this.nextHop = nextHop; this.type = type; }
Example #17
Source File: DefaultOpenstackVtapCriterion.java From onos with Apache License 2.0 | 5 votes |
private DefaultOpenstackVtapCriterion(IpPrefix srcIpPrefix, IpPrefix dstIpPrefix, byte ipProtocol, TpPort srcTpPort, TpPort dstTpPort) { this.srcIpPrefix = srcIpPrefix; this.dstIpPrefix = dstIpPrefix; this.ipProtocol = ipProtocol; this.srcTpPort = srcTpPort; this.dstTpPort = dstTpPort; }
Example #18
Source File: IpConcurrentRadixTree.java From onos with Apache License 2.0 | 5 votes |
@Override public V put(IpPrefix prefix, V value) { String prefixString = getPrefixString(prefix); if (prefix.isIp4()) { return ipv4Tree.put(prefixString, value); } if (prefix.isIp6()) { return ipv6Tree.put(prefixString, value); } return null; }
Example #19
Source File: RoutingRulePopulator.java From onos with Apache License 2.0 | 5 votes |
/** * Populates IP flow rules for all the given prefixes reachable from the * destination switch(es). * * @param targetSw switch where rules are to be programmed * @param subnets subnets/prefixes being added * @param destSw1 destination switch where the prefixes are reachable * @param destSw2 paired destination switch if one exists for the subnets/prefixes. * Should be null if there is no paired destination switch (by config) * or if the given prefixes are reachable only via destSw1 * @param nextHops a map containing a set of next-hops for each destination switch. * If destSw2 is not null, then this map must contain an * entry for destSw2 with its next-hops from the targetSw * (although the next-hop set may be empty in certain scenarios). * If destSw2 is null, there should not be an entry in this * map for destSw2. * @return true if all rules are set successfully, false otherwise */ boolean populateIpRuleForSubnet(DeviceId targetSw, Set<IpPrefix> subnets, DeviceId destSw1, DeviceId destSw2, Map<DeviceId, Set<DeviceId>> nextHops) { // Get pair device of the target switch Optional<DeviceId> pairDev = srManager.getPairDeviceId(targetSw); // Route simplification will be off in case of the nexthop location at target switch is down // (routing through spine case) boolean routeSimplOff = pairDev.isPresent() && pairDev.get().equals(destSw1) && destSw2 == null; // Iterates over the routes. Checking: // If route simplification is enabled // If the target device is another leaf in the network if (srManager.routeSimplification && !routeSimplOff) { Set<IpPrefix> subnetsToBePopulated = Sets.newHashSet(); for (IpPrefix subnet : subnets) { // Skip route programming on the target device // If route simplification applies if (routeSimplifierUtils.hasLeafExclusionEnabledForPrefix(subnet)) { // XXX route simplification assumes that source of the traffic // towards the nexthops are co-located with the nexthops. In different // scenarios will not work properly. continue; } // populate the route in the remaning scenarios subnetsToBePopulated.add(subnet); } subnets = subnetsToBePopulated; } // populate the remaining routes in the target switch return populateIpRulesForRouter(targetSw, subnets, destSw1, destSw2, nextHops); }
Example #20
Source File: IpConcurrentRadixTree.java From onos with Apache License 2.0 | 5 votes |
@Override public V getValueForExactAddress(IpPrefix prefix) { String prefixString = getPrefixString(prefix); if (prefix.isIp4()) { return ipv4Tree.getValueForExactKey(prefixString); } if (prefix.isIp6()) { return ipv6Tree.getValueForExactKey(prefixString); } return null; }
Example #21
Source File: DistributedFpmPrefixStore.java From onos with Apache License 2.0 | 5 votes |
/** * Add a dhcp fpm entry. * * @param prefix the route prefix in the advertisement * @param fpmRecord the route for fpm **/ @Override public void addFpmRecord(IpPrefix prefix, FpmRecord fpmRecord) { checkNotNull(prefix, "Prefix can't be null"); checkNotNull(fpmRecord, "Fpm record can't be null"); dhcpFpmRecords.put(prefix, fpmRecord); }
Example #22
Source File: IpConcurrentRadixTree.java From onos with Apache License 2.0 | 5 votes |
@Override public List<V> getValuesForAddressesStartingWith(IpPrefix prefix) { String prefixString = getPrefixString(prefix); if (prefix.isIp4()) { return Lists.newArrayList(ipv4Tree.getValuesForKeysStartingWith(prefixString)); } if (prefix.isIp6()) { return Lists.newArrayList(ipv6Tree.getValuesForKeysStartingWith(prefixString)); } return null; }
Example #23
Source File: IpConcurrentRadixTree.java From onos with Apache License 2.0 | 5 votes |
/** * Returns the value associated with the closest parent address from a * given radix tree, or returns null if no such value is associated * with the address. * * @param prefix IP prefix * @param tree a radix tree * @return A value associated with the closest parent address, or * null if no value was associated with the address */ private V getValueForClosestParentAddress(IpPrefix prefix, RadixTree<V> tree) { while (prefix != null && prefix.prefixLength() > 0) { V value = tree.getValueForExactKey(getPrefixString(prefix)); if (value != null) { return value; } prefix = getParentPrefix(prefix); } return null; }
Example #24
Source File: VpnPortManager.java From onos with Apache License 2.0 | 5 votes |
/** * Creates dummy gluon subnet to the VTN. * * @param tenantId the base port tenant ID */ public void createDummySubnet(TenantId tenantId) { String id = "22222222-2222-2222-2222-222222222222"; String subnetName = "GluonSubnet"; String cidr = "0.0.0.0/0"; String gatewayIp = "0.0.0.0"; Set<HostRoute> hostRoutes = Sets.newHashSet(); TenantNetworkId tenantNetworkId = null; Set<AllocationPool> allocationPools = Sets.newHashSet(); Iterable<TenantNetwork> networks = tenantNetworkService.getNetworks(); for (TenantNetwork tenantNetwork : networks) { if (tenantNetwork.name().equals("GluonNetwork")) { tenantNetworkId = tenantNetwork.id(); break; } } Subnet subnet = new DefaultSubnet(SubnetId.subnetId(id), subnetName, tenantNetworkId, tenantId, IpAddress.Version.INET, IpPrefix.valueOf(cidr), IpAddress.valueOf(gatewayIp), false, false, hostRoutes, null, null, allocationPools); Set<Subnet> subnetsSet = Sets.newHashSet(subnet); subnetService.createSubnets(subnetsSet); }
Example #25
Source File: DefaultRouteTable.java From onos with Apache License 2.0 | 5 votes |
@Override public Collection<RouteSet> getRoutes() { return routes.stream() .map(Map.Entry::getValue) .collect(Collectors.groupingBy(RawRoute::prefix)) .entrySet() .stream() .map(entry -> new RouteSet(id, IpPrefix.valueOf(entry.getKey()), entry.getValue().stream().map(RawRoute::route).collect(Collectors.toSet()))) .collect(Collectors.toList()); }
Example #26
Source File: LispExpireMapDatabase.java From onos with Apache License 2.0 | 5 votes |
/** * Returns the map record associated with the closest parent address from a * given expire map, or returns null if no such map record is associated * with the address. * * @param prefix IP prefix * @return a map record with the closest parent address, or null if no value * was associated with the address */ private LispProxyMapRecord getMapRecordForClosestParentAddress(IpPrefix prefix) { while (prefix != null && prefix.prefixLength() > 0) { LispProxyMapRecord record = map.get(getEidRecordFromIpPrefix(prefix)); if (record != null) { return record; } prefix = getParentPrefix(prefix); } return null; }
Example #27
Source File: RoutingRulePopulator.java From onos with Apache License 2.0 | 5 votes |
private TrafficSelector.Builder buildIpSelectorFromIpPrefix(IpPrefix prefixToMatch) { TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder(); // If the prefix is IPv4 if (prefixToMatch.isIp4()) { selectorBuilder.matchEthType(Ethernet.TYPE_IPV4); selectorBuilder.matchIPDst(prefixToMatch.getIp4Prefix()); return selectorBuilder; } // If the prefix is IPv6 selectorBuilder.matchEthType(Ethernet.TYPE_IPV6); selectorBuilder.matchIPv6Dst(prefixToMatch.getIp6Prefix()); return selectorBuilder; }
Example #28
Source File: PeerConnectivityManagerTest.java From onos with Apache License 2.0 | 5 votes |
/** * Constructs a BGP intent and put it into the intentList. * <p/> * The purpose of this method is too simplify the setUpBgpIntents() method, * and to make the setUpBgpIntents() easy to read. * * @param srcVlanId ingress VlanId * @param dstVlanId egress VlanId * @param srcPrefix source IP prefix to match * @param dstPrefix destination IP prefix to match * @param srcConnectPoint source connect point for PointToPointIntent * @param dstConnectPoint destination connect point for PointToPointIntent */ private void icmpPathintentConstructor(VlanId srcVlanId, VlanId dstVlanId, String srcPrefix, String dstPrefix, ConnectPoint srcConnectPoint, ConnectPoint dstConnectPoint) { TrafficSelector.Builder builder = DefaultTrafficSelector.builder() .matchEthType(Ethernet.TYPE_IPV4) .matchIPProtocol(IPv4.PROTOCOL_ICMP) .matchIPSrc(IpPrefix.valueOf(srcPrefix)) .matchIPDst(IpPrefix.valueOf(dstPrefix)); if (!srcVlanId.equals(VlanId.NONE)) { builder.matchVlanId(srcVlanId); } TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder(); if (!dstVlanId.equals(VlanId.NONE)) { treatment.setVlanId(dstVlanId); } Key key = Key.of(srcPrefix.split("/")[0] + "-" + dstPrefix.split("/")[0] + "-" + "icmp", APPID); PointToPointIntent intent = PointToPointIntent.builder() .appId(APPID) .key(key) .selector(builder.build()) .treatment(treatment.build()) .filteredIngressPoint(new FilteredConnectPoint(srcConnectPoint)) .filteredEgressPoint(new FilteredConnectPoint(dstConnectPoint)) .build(); intentList.add(intent); }
Example #29
Source File: DefaultStatsFlowRuleTest.java From onos with Apache License 2.0 | 5 votes |
/** * Initial setup for this unit test. */ @Before public void setUp() { rule1 = DefaultStatsFlowRule.builder() .srcIpPrefix(IpPrefix.valueOf(IP_ADDRESS_1, IP_PREFIX_LENGTH_1)) .dstIpPrefix(IpPrefix.valueOf(IP_ADDRESS_2, IP_PREFIX_LENGTH_2)) .srcTpPort(TpPort.tpPort(PORT_1)) .dstTpPort(TpPort.tpPort(PORT_2)) .ipProtocol(PROTOCOL_1) .build(); sameAsRule1 = DefaultStatsFlowRule.builder() .srcIpPrefix(IpPrefix.valueOf(IP_ADDRESS_1, IP_PREFIX_LENGTH_1)) .dstIpPrefix(IpPrefix.valueOf(IP_ADDRESS_2, IP_PREFIX_LENGTH_2)) .srcTpPort(TpPort.tpPort(PORT_1)) .dstTpPort(TpPort.tpPort(PORT_2)) .ipProtocol(PROTOCOL_1) .build(); rule2 = DefaultStatsFlowRule.builder() .srcIpPrefix(IpPrefix.valueOf(IP_ADDRESS_2, IP_PREFIX_LENGTH_2)) .dstIpPrefix(IpPrefix.valueOf(IP_ADDRESS_1, IP_PREFIX_LENGTH_1)) .srcTpPort(TpPort.tpPort(PORT_2)) .dstTpPort(TpPort.tpPort(PORT_1)) .ipProtocol(PROTOCOL_2) .build(); }
Example #30
Source File: SegmentRoutingAppConfigTest.java From onos with Apache License 2.0 | 5 votes |
/** * Tests BlackHoleIps setter. * * @throws Exception */ @Test public void testSetBlackHoleIps() throws Exception { config.setBalckholeIps(ImmutableSet.of(BLACKHOLE_IP_2)); Set<IpPrefix> blackHoleIps = config.blackholeIPs(); assertThat(blackHoleIps.size(), is(1)); assertTrue(blackHoleIps.contains(BLACKHOLE_IP_2)); }