use of org.onosproject.mapping.addresses.MappingAddress in project onos by opennetworkinglab.
the class LispTeAddressTest method setUp.
@Before
public void setUp() {
MappingAddress ma1 = MappingAddresses.ipv4MappingAddress(IP_ADDRESS_1);
MappingAddress ma2 = MappingAddresses.ipv4MappingAddress(IP_ADDRESS_2);
LispTeAddress.TeRecord tr1 = new LispTeAddress.TeRecord.Builder().withIsLookup(IS_LOOKUP_1).withIsRlocProbe(IS_RLOC_PROBE_1).withIsStrict(IS_STRICT_1).withRtrRlocAddress(ma1).build();
LispTeAddress.TeRecord tr2 = new LispTeAddress.TeRecord.Builder().withIsLookup(IS_LOOKUP_2).withIsRlocProbe(IS_RLOC_PROBE_2).withIsStrict(IS_STRICT_2).withRtrRlocAddress(ma2).build();
address1 = new LispTeAddress.Builder().withTeRecords(ImmutableList.of(tr1, tr2)).build();
sameAsAddress1 = new LispTeAddress.Builder().withTeRecords(ImmutableList.of(tr1, tr2)).build();
address2 = new LispTeAddress.Builder().withTeRecords(ImmutableList.of(tr2, tr1)).build();
}
use of org.onosproject.mapping.addresses.MappingAddress in project onos by opennetworkinglab.
the class LispTeAddressTest method testConstruction.
@Test
public void testConstruction() {
LispTeAddress address = address1;
MappingAddress ma = MappingAddresses.ipv4MappingAddress(IP_ADDRESS_1);
assertThat(address.getTeRecords().get(0).isLookup(), is(IS_LOOKUP_1));
assertThat(address.getTeRecords().get(0).isRlocProbe(), is(IS_RLOC_PROBE_1));
assertThat(address.getTeRecords().get(0).isStrict(), is(IS_STRICT_1));
assertThat(address.getTeRecords().get(0).getAddress(), is(ma));
}
use of org.onosproject.mapping.addresses.MappingAddress in project onos by opennetworkinglab.
the class LispNatAddressCodecTest method testLispNatAddressEncode.
/**
* Tests encoding of a LispNatAddress object.
*/
@Test
public void testLispNatAddressEncode() {
List<MappingAddress> rtrRlocs = ImmutableList.of(MappingAddresses.ipv4MappingAddress(GLOBAL_ETR_RLOC_ADDRESS), MappingAddresses.ipv4MappingAddress(MS_RLOC_ADDRESS), MappingAddresses.ipv4MappingAddress(PRIVATE_ETR_RLOC_ADDRESS));
LispNatAddress address = new LispNatAddress.Builder().withMsUdpPortNumber(MS_UDP_PORT_NUMBER).withEtrUdpPortNumber(ETR_UDP_PORT_NUMBER).withGlobalEtrRlocAddress(MappingAddresses.ipv4MappingAddress(GLOBAL_ETR_RLOC_ADDRESS)).withMsRlocAddress(MappingAddresses.ipv4MappingAddress(MS_RLOC_ADDRESS)).withPrivateEtrRlocAddress(MappingAddresses.ipv4MappingAddress(PRIVATE_ETR_RLOC_ADDRESS)).withRtrRlocAddresses(rtrRlocs).build();
ObjectNode addressJson = natAddressCodec.encode(address, context);
assertThat("errors in encoding NAT address JSON", addressJson, LispNatAddressJsonMatcher.matchesNatAddress(address));
}
use of org.onosproject.mapping.addresses.MappingAddress in project onos by opennetworkinglab.
the class LispAppDataAddressTest method testConstruction.
@Test
public void testConstruction() {
LispAppDataAddress address = address1;
MappingAddress ma = MappingAddresses.ipv4MappingAddress(IP_ADDRESS_1);
assertThat(address.getProtocol(), is(PROTOCOL_VALUE_1));
assertThat(address.getIpTos(), is(IP_TOS_VALUE_1));
assertThat(address.getLocalPortLow(), is(LOCAL_PORT_LOW_VALUE));
assertThat(address.getLocalPortHigh(), is(LOCAL_PORT_HIGH_VALUE));
assertThat(address.getRemotePortLow(), is(REMOTE_PORT_LOW_VALUE));
assertThat(address.getRemotePortHigh(), is(REMOTE_PORT_HIGH_VALUE));
assertThat(address.getAddress(), is(ma));
}
use of org.onosproject.mapping.addresses.MappingAddress in project onos by opennetworkinglab.
the class LispAsAddressTest method setUp.
@Before
public void setUp() {
MappingAddress ma1 = MappingAddresses.ipv4MappingAddress(IP_ADDRESS_1);
address1 = new LispAsAddress.Builder().withAsNumber(AS_NUMBER_1).withAddress(ma1).build();
sameAsAddress1 = new LispAsAddress.Builder().withAsNumber(AS_NUMBER_1).withAddress(ma1).build();
MappingAddress ma2 = MappingAddresses.ipv4MappingAddress(IP_ADDRESS_2);
address2 = new LispAsAddress.Builder().withAsNumber(AS_NUMBER_2).withAddress(ma2).build();
}
Aggregations