use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey in project netvirt by opendaylight.
the class ElanServiceTest method checkDmacOfOtherDPN.
@Test
public void checkDmacOfOtherDPN() throws Exception {
// Create Elan instance
createElanInstance(ExpectedObjects.ELAN1, ExpectedObjects.ELAN1_SEGMENT_ID);
awaitForElanTag(ExpectedObjects.ELAN1);
InterfaceInfo interfaceInfo = ELAN_INTERFACES.get(ELAN1 + ":" + DPN1MAC1).getLeft();
addElanInterface(ExpectedObjects.ELAN1, interfaceInfo, DPN1IP1);
// Read Elan instance
InstanceIdentifier<ElanInstance> elanInstanceIid = InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class, new ElanInstanceKey(ExpectedObjects.ELAN1)).build();
ElanInstance actualElanInstances = singleTxdataBroker.syncRead(CONFIGURATION, elanInstanceIid);
interfaceInfo = ELAN_INTERFACES.get(ELAN1 + ":" + DPN2MAC1).getLeft();
addElanInterface(ExpectedObjects.ELAN1, interfaceInfo, DPN2IP1);
// Read and Compare DMAC flow in DPN1 for MAC1 of DPN2
String flowId = ElanUtils.getKnownDynamicmacFlowRef((short) 51, DPN1_ID, DPN2_ID, interfaceInfo.getMacAddress().toString(), actualElanInstances.getElanTag());
InstanceIdentifier<Flow> flowInstanceIidDst = getFlowIid(NwConstants.ELAN_DMAC_TABLE, new FlowId(flowId), DPN1_ID);
awaitForData(LogicalDatastoreType.CONFIGURATION, flowInstanceIidDst);
Flow flowDst = singleTxdataBroker.syncRead(CONFIGURATION, flowInstanceIidDst);
flowDst = getFlowWithoutCookie(flowDst);
TunnelInterfaceDetails tepDetails = EXTN_INTFS.get(DPN1_ID_STR + ":" + DPN2_ID_STR);
Flow expected = ExpectedObjects.checkDmacOfOtherDPN(flowId, interfaceInfo, tepDetails, actualElanInstances);
AssertDataObjects.assertEqualBeans(getSortedActions(expected), getSortedActions(flowDst));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey in project netvirt by opendaylight.
the class NeutronNetworkChangeListener method createElanInstanceBuilder.
private ElanInstanceBuilder createElanInstanceBuilder(String elanInstanceName, Class<? extends SegmentTypeBase> segmentType, String segmentationId, String physicalNetworkName, Network network) {
Boolean isExternal = NeutronvpnUtils.getIsExternal(network);
List<ElanSegments> segments = buildSegments(network);
ElanInstanceBuilder elanInstanceBuilder = new ElanInstanceBuilder().setElanInstanceName(elanInstanceName);
if (segmentType != null) {
elanInstanceBuilder.setSegmentType(segmentType);
if (segmentationId != null) {
elanInstanceBuilder.setSegmentationId(Long.valueOf(segmentationId));
}
if (physicalNetworkName != null) {
elanInstanceBuilder.setPhysicalNetworkName(physicalNetworkName);
}
}
elanInstanceBuilder.setElanSegments(segments);
elanInstanceBuilder.setExternal(isExternal);
elanInstanceBuilder.setKey(new ElanInstanceKey(elanInstanceName));
return elanInstanceBuilder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey in project netvirt by opendaylight.
the class NeutronPortChangeListenerTest method setUp.
@Before
public void setUp() {
doReturn(mockWriteTx).when(dataBroker).newWriteOnlyTransaction();
doReturn(Futures.immediateCheckedFuture(null)).when(mockWriteTx).submit();
doReturn(mockReadTx).when(dataBroker).newReadOnlyTransaction();
when(mockReadTx.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class))).thenReturn(Futures.immediateCheckedFuture(Optional.of(mockNetwork)));
neutronPortChangeListener = new NeutronPortChangeListener(dataBroker, neutronvpnManager, neutronvpnNatManager, gwMacResolver, elanService, jobCoordinator, new NeutronvpnUtils(dataBroker, idManager, jobCoordinator, ipV6InternetDefRt), new HostConfigCache(dataBroker, new GuavaCacheProvider(new CacheManagersRegistryImpl())));
InstanceIdentifier<ElanInstance> elanIdentifierId = InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class, new ElanInstanceKey(new Uuid("12345678-1234-1234-1234-123456789012").getValue())).build();
when(mockReadTx.read(any(LogicalDatastoreType.class), eq(elanIdentifierId))).thenReturn(Futures.immediateCheckedFuture(Optional.of(elanInstance)));
}
Aggregations