@Test public void testCreateForwardingContext2() { // case #2 - L2FloodDomain is present in DS, but its parent is null DataBroker dataBroker = getDataBroker(); ReadWriteTransaction rwTx = dataBroker.newReadWriteTransaction(); l2FloodDomainBuilder.setParent(null); L2FloodDomain l2FloodDomain = l2FloodDomainBuilder.build(); writeL2FloodDomain(tenantId, l2FloodDomain, rwTx); MappingUtils.ForwardingCtx forwardingCtx = MappingUtils.createForwardingContext(tenantId, l2FloodDomainBuilder.build().getId(), rwTx); assertNotNull(forwardingCtx); assertTrue(forwardingCtx.getL2FloodDomain().equals(l2FloodDomain)); assertNull(forwardingCtx.getL2BridgeDomain()); assertNull(forwardingCtx.getL3Context()); }
@Test public void testCreateForwardingContext1() { // case #1 - L2FloodDomain is not present in DS DataBroker dataBroker = getDataBroker(); ReadWriteTransaction rwTx = dataBroker.newReadWriteTransaction(); MappingUtils.ForwardingCtx forwardingCtx = MappingUtils.createForwardingContext(tenantId, l2FloodDomainBuilder.build().getId(), rwTx); assertNotNull(forwardingCtx); assertNull(forwardingCtx.getL2FloodDomain()); assertNull(forwardingCtx.getL2BridgeDomain()); assertNull(forwardingCtx.getL3Context()); }
@Before public void init() { l2FloodDomainBuilder = new L2FloodDomainBuilder(); l2FloodDomainBuilder.setName(new Name("l2fdn")).setKey(new L2FloodDomainKey(l2FloodDomainId)); l2BridgeDomainBuilder = new L2BridgeDomainBuilder(); l2BridgeDomainBuilder .setName(new Name("l2bdn")) .setKey(new L2BridgeDomainKey(l2BridgeDomainId)); l3ContextBuilder = new L3ContextBuilder(); l3ContextBuilder.setName(new Name("l3cn")).setKey(new L3ContextKey(l3ContextId)); Neutron_IPs neutronIp1 = new Neutron_IPs(); Neutron_IPs neutronIp2 = new Neutron_IPs(); Neutron_IPs neutronIp3 = new Neutron_IPs(); neutronIp1.setIpAddress(ips[0]); neutronIp2.setIpAddress(ips[1]); neutronIp3.setIpAddress(ips[2]); emptyList = new ArrayList<>(); singleIp = new ArrayList<>(); singleIp.add(neutronIp1); multiIp = new ArrayList<>(); multiIp.add(neutronIp1); multiIp.add(neutronIp2); multiIp.add(neutronIp3); }