Search in sources :

Example 11 with ElanInstanceKey

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));
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) TunnelInterfaceDetails(org.opendaylight.genius.testutils.interfacemanager.TunnelInterfaceDetails) ElanInstanceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey) InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) Test(org.junit.Test)

Example 12 with ElanInstanceKey

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;
}
Also used : ElanSegments(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ElanSegments) ElanInstanceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey) ElanInstanceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder)

Example 13 with ElanInstanceKey

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)));
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) CacheManagersRegistryImpl(org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl) ElanInstanceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) GuavaCacheProvider(org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider) Before(org.junit.Before)

Aggregations

ElanInstanceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey)13 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)10 ElanInstanceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder)4 Test (org.junit.Test)3 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)3 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)3 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)3 BigInteger (java.math.BigInteger)2 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)2 ElanServiceChainState (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.ElanServiceChainState)2 ElanToPseudoPortData (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortData)2 ElanInstances (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInstances)2 Before (org.junit.Before)1 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)1 TunnelInterfaceDetails (org.opendaylight.genius.testutils.interfacemanager.TunnelInterfaceDetails)1 CacheManagersRegistryImpl (org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl)1 GuavaCacheProvider (org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider)1 L2GatewayDevice (org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)1 ElanToPseudoPortDataBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortDataBuilder)1 ElanToPseudoPortDataKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortDataKey)1