Search in sources :

Example 36 with MappingAddress

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();
}
Also used : MappingAddress(org.onosproject.mapping.addresses.MappingAddress) Before(org.junit.Before)

Example 37 with MappingAddress

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));
}
Also used : MappingAddress(org.onosproject.mapping.addresses.MappingAddress) Test(org.junit.Test)

Example 38 with MappingAddress

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));
}
Also used : MappingAddress(org.onosproject.mapping.addresses.MappingAddress) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) LispNatAddress(org.onosproject.drivers.lisp.extensions.LispNatAddress) Test(org.junit.Test)

Example 39 with MappingAddress

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));
}
Also used : MappingAddress(org.onosproject.mapping.addresses.MappingAddress) Test(org.junit.Test)

Example 40 with MappingAddress

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();
}
Also used : MappingAddress(org.onosproject.mapping.addresses.MappingAddress) Before(org.junit.Before)

Aggregations

MappingAddress (org.onosproject.mapping.addresses.MappingAddress)66 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)34 Test (org.junit.Test)26 Before (org.junit.Before)11 DefaultMappingTreatment (org.onosproject.mapping.DefaultMappingTreatment)7 MappingTreatment (org.onosproject.mapping.MappingTreatment)7 MappingAddressJsonMatcher.matchesMappingAddress (org.onosproject.mapping.codec.MappingAddressJsonMatcher.matchesMappingAddress)7 IpPrefix (org.onlab.packet.IpPrefix)6 MappingInstruction (org.onosproject.mapping.instructions.MappingInstruction)6 DefaultMappingKey (org.onosproject.mapping.DefaultMappingKey)5 MappingKey (org.onosproject.mapping.MappingKey)5 DefaultMappingValue (org.onosproject.mapping.DefaultMappingValue)4 MappingValue (org.onosproject.mapping.MappingValue)4 MappingAction (org.onosproject.mapping.actions.MappingAction)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2 EqualsTester (com.google.common.testing.EqualsTester)2 LispNatAddress (org.onosproject.drivers.lisp.extensions.LispNatAddress)2 LispTeRecord (org.onosproject.lisp.msg.types.lcaf.LispTeRecord)2 DefaultMapping (org.onosproject.mapping.DefaultMapping)2