use of org.onosproject.mapping.addresses.MappingAddress in project onos by opennetworkinglab.
the class MappingAddressCodecTest method ethMappingAddressTest.
/**
* Tests Ethernet mapping address.
*/
@Test
public void ethMappingAddressTest() {
MappingAddress address = MappingAddresses.ethMappingAddress(MAC);
ObjectNode result = addressCodec.encode(address, context);
assertThat(result, matchesMappingAddress(address));
}
use of org.onosproject.mapping.addresses.MappingAddress in project onos by opennetworkinglab.
the class MappingAddressCodecTest method dnMappingAddressTest.
/**
* Tests DN mapping address.
*/
@Test
public void dnMappingAddressTest() {
MappingAddress address = MappingAddresses.dnMappingAddress(DN);
ObjectNode result = addressCodec.encode(address, context);
assertThat(result, matchesMappingAddress(address));
}
use of org.onosproject.mapping.addresses.MappingAddress in project onos by opennetworkinglab.
the class MappingAddressCodecTest method testMappingAddressDecode.
/**
* Tests the decoding of mapping address from JSON object.
*
* @throws IOException if processing the resource fails
*/
@Test
public void testMappingAddressDecode() throws IOException {
MappingAddress address = getAddress("MappingAddress.json");
assertThat(address.toString(), is("IPV4:" + IPV4_STRING + "/" + PORT_STRING));
}
use of org.onosproject.mapping.addresses.MappingAddress in project onos by opennetworkinglab.
the class MappingAddressCodecTest method asMappingAddressTest.
/**
* Tests AS mapping address.
*/
@Test
public void asMappingAddressTest() {
MappingAddress address = MappingAddresses.asMappingAddress(AS);
ObjectNode result = addressCodec.encode(address, context);
assertThat(result, matchesMappingAddress(address));
}
use of org.onosproject.mapping.addresses.MappingAddress in project onos by opennetworkinglab.
the class MappingEntryCodecTest method testMappingEntryEncode.
/**
* Tests encoding of a mapping entry object.
*/
@Test
public void testMappingEntryEncode() {
MappingAddress address = MappingAddresses.ipv4MappingAddress(IPV4_PREFIX);
MappingInstruction unicastWeight = MappingInstructions.unicastWeight(UNICAST_WEIGHT);
MappingInstruction unicastPriority = MappingInstructions.unicastPriority(UNICAST_PRIORITY);
MappingInstruction multicastWeight = MappingInstructions.multicastWeight(MULTICAST_WEIGHT);
MappingInstruction multicastPriority = MappingInstructions.multicastPriority(MULTICAST_PRIORITY);
MappingKey key = DefaultMappingKey.builder().withAddress(address).build();
MappingTreatment treatment = DefaultMappingTreatment.builder().add(unicastWeight).add(unicastPriority).add(multicastWeight).add(multicastPriority).withAddress(address).build();
MappingAction action = MappingActions.noAction();
MappingValue value = DefaultMappingValue.builder().add(treatment).withAction(action).build();
Mapping mapping = DefaultMapping.builder().withId(ID).forDevice(DEVICE_ID).withKey(key).withValue(value).build();
MappingEntry entry = new DefaultMappingEntry(mapping, STATE);
ObjectNode entryJson = entryCodec.encode(entry, context);
assertThat(entryJson, MappingEntryJsonMatcher.matchesMappingEntry(entry));
}
Aggregations