Search in sources :

Example 1 with TunnelInterfaceDetails

use of org.opendaylight.genius.testutils.interfacemanager.TunnelInterfaceDetails 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)

Aggregations

Test (org.junit.Test)1 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)1 TunnelInterfaceDetails (org.opendaylight.genius.testutils.interfacemanager.TunnelInterfaceDetails)1 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)1 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)1 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)1 ElanInstanceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey)1