use of org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation in project onos by opennetworkinglab.
the class MaintenanceAssociationCodecTest method testDecodeMa1.
@Test
public void testDecodeMa1() throws IOException {
String mdString = "{\"ma\": { \"maName\": \"ma-1\"," + "\"maNameType\": \"CHARACTERSTRING\"," + "\"component-list\": [], " + "\"rmep-list\": [], " + "\"maNumericId\": 1}}";
InputStream input = new ByteArrayInputStream(mdString.getBytes(StandardCharsets.UTF_8));
JsonNode cfg = mapper.readTree(input);
MaintenanceAssociation maDecode1 = ((MaintenanceAssociationCodec) context.codec(MaintenanceAssociation.class)).decode((ObjectNode) cfg, context, 10);
assertEquals(MAID1_CHAR, maDecode1.maId());
assertEquals(1, maDecode1.maNumericId());
}
use of org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation in project onos by opennetworkinglab.
the class MaintenanceAssociationCodecTest method testDecodeMa2.
@Test
public void testDecodeMa2() throws IOException {
String mdString = "{\"ma\": { \"maName\": 1234," + "\"maNameType\": \"PRIMARYVID\"," + "\"component-list\": [], " + "\"rmep-list\": [], " + "\"maNumericId\": 2}}";
InputStream input = new ByteArrayInputStream(mdString.getBytes(StandardCharsets.UTF_8));
JsonNode cfg = mapper.readTree(input);
MaintenanceAssociation maDecode2 = ((MaintenanceAssociationCodec) context.codec(MaintenanceAssociation.class)).decode((ObjectNode) cfg, context, 10);
assertEquals(MAID2_VID, maDecode2.maId());
}
use of org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation in project onos by opennetworkinglab.
the class MaintenanceAssociationCodecTest method testDecodeMa4.
@Test
public void testDecodeMa4() throws IOException {
String mdString = "{\"ma\": { \"maName\": \"aa:bb:cc:dd:ee:ff:99\"," + "\"maNameType\": \"RFC2685VPNID\"," + "\"component-list\": [], " + "\"rmep-list\": [], " + "\"maNumericId\": 4}}";
InputStream input = new ByteArrayInputStream(mdString.getBytes(StandardCharsets.UTF_8));
JsonNode cfg = mapper.readTree(input);
MaintenanceAssociation maDecode4 = ((MaintenanceAssociationCodec) context.codec(MaintenanceAssociation.class)).decode((ObjectNode) cfg, context, 10);
assertEquals(MAID4_RFC, maDecode4.maId());
}
use of org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation in project onos by opennetworkinglab.
the class MaintenanceAssociationCodecTest method testEncodeMa5.
@Test
public void testEncodeMa5() throws CfmConfigException {
MaintenanceAssociation ma1 = DefaultMaintenanceAssociation.builder(MAID5_Y1731, 10).maNumericId((short) 5).build();
ObjectNode node = mapper.createObjectNode();
node.set("ma", context.codec(MaintenanceAssociation.class).encode(ma1, context));
assertEquals("{\"ma\":{" + "\"maName\":\"abc:defghij\"," + "\"maNameType\":\"ICCY1731\"," + "\"maNumericId\":5," + "\"component-list\":[]," + "\"rmep-list\":[]}}", node.toString());
}
use of org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation in project onos by opennetworkinglab.
the class MaintenanceAssociationCodecTest method testDecodeMa1NoTypeGiven.
@Test
public void testDecodeMa1NoTypeGiven() throws IOException {
String mdString = "{\"ma\": { \"maName\": \"ma-1\"," + "\"component-list\": [], " + "\"rmep-list\": [], " + "\"maNumericId\": 1}}";
InputStream input = new ByteArrayInputStream(mdString.getBytes(StandardCharsets.UTF_8));
JsonNode cfg = mapper.readTree(input);
MaintenanceAssociation maDecode1 = ((MaintenanceAssociationCodec) context.codec(MaintenanceAssociation.class)).decode((ObjectNode) cfg, context, 10);
assertEquals(MAID1_CHAR, maDecode1.maId());
assertEquals(1, maDecode1.maNumericId());
}
Aggregations