use of org.onosproject.net.config.ConfigApplyDelegate in project trellis-control by opennetworkinglab.
the class SegmentRoutingAppConfigTest method setUp.
/**
* Initialize test related variables.
*
* @throws Exception
*/
@Before
public void setUp() throws Exception {
InputStream jsonStream = SegmentRoutingAppConfigTest.class.getResourceAsStream("/app.json");
InputStream invalidJsonStream = SegmentRoutingAppConfigTest.class.getResourceAsStream("/app-invalid.json");
InputStream mplsEcmpJsonStream = SegmentRoutingAppConfigTest.class.getResourceAsStream("/app-ecmp.json");
String key = APP_NAME;
ApplicationId subject = new TestApplicationId(key);
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree(jsonStream);
JsonNode invalidJsonNode = mapper.readTree(invalidJsonStream);
JsonNode mplsEcmpJsonNode = mapper.readTree(mplsEcmpJsonStream);
ConfigApplyDelegate delegate = new MockDelegate();
config = new SegmentRoutingAppConfig();
config.init(subject, key, jsonNode, mapper, delegate);
invalidConfig = new SegmentRoutingAppConfig();
invalidConfig.init(subject, key, invalidJsonNode, mapper, delegate);
mplsEcmpConfig = new SegmentRoutingAppConfig();
mplsEcmpConfig.init(subject, key, mplsEcmpJsonNode, mapper, delegate);
}
use of org.onosproject.net.config.ConfigApplyDelegate in project trellis-control by opennetworkinglab.
the class SegmentRoutingDeviceConfigTest method setUp.
@Before
public void setUp() throws Exception {
InputStream jsonStream = SegmentRoutingDeviceConfigTest.class.getResourceAsStream("/device.json");
InputStream ipv6JsonStream = SegmentRoutingDeviceConfigTest.class.getResourceAsStream("/device-ipv6.json");
InputStream pairJsonStream = SegmentRoutingDeviceConfigTest.class.getResourceAsStream("/device-pair.json");
InputStream invalidJsonStream = SegmentRoutingDeviceConfigTest.class.getResourceAsStream("/device-invalid.json");
adjacencySids1 = new HashMap<>();
Set<Integer> ports1 = new HashSet<>();
ports1.add(2);
ports1.add(3);
adjacencySids1.put(100, ports1);
Set<Integer> ports2 = new HashSet<>();
ports2.add(4);
ports2.add(5);
adjacencySids1.put(200, ports2);
adjacencySids2 = new HashMap<>();
Set<Integer> ports3 = new HashSet<>();
ports3.add(6);
adjacencySids2.put(300, ports3);
DeviceId subject = DeviceId.deviceId("of:0000000000000001");
String key = "segmentrouting";
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree(jsonStream);
JsonNode ipv6JsonNode = mapper.readTree(ipv6JsonStream);
JsonNode pairJsonNode = mapper.readTree(pairJsonStream);
JsonNode invalidJsonNode = mapper.readTree(invalidJsonStream);
ConfigApplyDelegate delegate = new MockDelegate();
config = new SegmentRoutingDeviceConfig();
config.init(subject, key, jsonNode, mapper, delegate);
ipv6Config = new SegmentRoutingDeviceConfig();
ipv6Config.init(subject, key, ipv6JsonNode, mapper, delegate);
pairConfig = new SegmentRoutingDeviceConfig();
pairConfig.init(subject, key, pairJsonNode, mapper, delegate);
invalidConfig = new SegmentRoutingDeviceConfig();
invalidConfig.init(subject, key, invalidJsonNode, mapper, delegate);
}
Aggregations