use of org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain in project onos by opennetworkinglab.
the class MaintenanceDomainCodecTest method testDecodeMd1NoTypeGiven.
@Test
public void testDecodeMd1NoTypeGiven() throws IOException {
String mdString = "{\"md\": { \"mdName\": \"test-1\"," + "\"mdLevel\": \"LEVEL1\", \"mdNumericId\": 1}}";
InputStream input = new ByteArrayInputStream(mdString.getBytes(StandardCharsets.UTF_8));
JsonNode cfg = mapper.readTree(input);
MaintenanceDomain mdDecode1 = context.codec(MaintenanceDomain.class).decode((ObjectNode) cfg, context);
assertEquals(MDID1_CHAR, mdDecode1.mdId());
assertEquals(MaintenanceDomain.MdLevel.LEVEL1, mdDecode1.mdLevel());
assertEquals(1, mdDecode1.mdNumericId());
}
use of org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain in project onos by opennetworkinglab.
the class MaintenanceDomainCodecTest method testDecodeMd4.
@Test
public void testDecodeMd4() throws IOException {
String mdString = "{\"md\": { \"mdName\": \"\"," + "\"mdNameType\": \"NONE\"}}";
InputStream input = new ByteArrayInputStream(mdString.getBytes(StandardCharsets.UTF_8));
JsonNode cfg = mapper.readTree(input);
MaintenanceDomain mdDecode1 = context.codec(MaintenanceDomain.class).decode((ObjectNode) cfg, context);
assertEquals(MDID4_NONE, mdDecode1.mdId());
}
use of org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain in project onos by opennetworkinglab.
the class MaintenanceDomainCodecTest method testEncodeMd1.
@Test
public void testEncodeMd1() throws CfmConfigException {
MaintenanceDomain md1 = DefaultMaintenanceDomain.builder(MDID1_CHAR).mdLevel(MaintenanceDomain.MdLevel.LEVEL1).mdNumericId((short) 1).build();
ObjectNode node = mapper.createObjectNode();
node.set("md", context.codec(MaintenanceDomain.class).encode(md1, context));
assertEquals("{\"md\":{" + "\"mdName\":\"test-1\"," + "\"mdNameType\":\"CHARACTERSTRING\"," + "\"mdLevel\":\"LEVEL1\"," + "\"mdNumericId\":1," + "\"maList\":[]}}", node.toString());
}
use of org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain in project onos by opennetworkinglab.
the class MaintenanceDomainCodecTest method testEncodeMd4.
@Test
public void testEncodeMd4() throws CfmConfigException {
MaintenanceDomain md4 = DefaultMaintenanceDomain.builder(MDID4_NONE).mdLevel(MaintenanceDomain.MdLevel.LEVEL4).build();
ObjectNode node = mapper.createObjectNode();
node.set("md", context.codec(MaintenanceDomain.class).encode(md4, context));
assertEquals("{\"md\":{" + "\"mdName\":\"\"," + "\"mdNameType\":\"NONE\"," + "\"mdLevel\":\"LEVEL4\"," + "\"maList\":[]}}", node.toString());
}
use of org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain in project onos by opennetworkinglab.
the class MaintenanceDomainCodecTest method testDecodeMd3.
@Test
public void testDecodeMd3() throws IOException {
String mdString = "{\"md\": { \"mdName\": \"aa:bb:cc:dd:ee:ff:181\"," + "\"mdNameType\": \"MACANDUINT\"}}";
InputStream input = new ByteArrayInputStream(mdString.getBytes(StandardCharsets.UTF_8));
JsonNode cfg = mapper.readTree(input);
MaintenanceDomain mdDecode1 = context.codec(MaintenanceDomain.class).decode((ObjectNode) cfg, context);
assertEquals(MDID3_MACUINT, mdDecode1.mdId());
}
Aggregations