use of org.opendaylight.genius.interfacemanager.globals.InterfaceInfo in project netvirt by opendaylight.
the class ElanInterfaceStateChangeListener method remove.
@Override
protected void remove(InstanceIdentifier<Interface> identifier, Interface delIf) {
if (!L2vlan.class.equals(delIf.getType())) {
return;
}
LOG.trace("Received interface {} Down event", delIf);
String interfaceName = delIf.getName();
Optional<ElanInterface> elanInterface = elanInterfaceCache.get(interfaceName);
if (!elanInterface.isPresent()) {
LOG.debug("No Elan Interface is created for the interface:{} ", interfaceName);
return;
}
NodeConnectorId nodeConnectorId = new NodeConnectorId(delIf.getLowerLayerIf().get(0));
BigInteger dpId = BigInteger.valueOf(MDSALUtil.getDpnIdFromPortName(nodeConnectorId));
InterfaceInfo interfaceInfo = new InterfaceInfo(dpId, nodeConnectorId.getValue());
interfaceInfo.setInterfaceName(interfaceName);
interfaceInfo.setInterfaceType(InterfaceInfo.InterfaceType.VLAN_INTERFACE);
interfaceInfo.setInterfaceTag(delIf.getIfIndex());
String elanInstanceName = elanInterface.get().getElanInstanceName();
ElanInstance elanInstance = elanInstanceCache.get(elanInstanceName).orNull();
if (elanInstance == null) {
LOG.debug("No Elan instance is available for the interface:{} ", interfaceName);
return;
}
InterfaceRemoveWorkerOnElan removeWorker = new InterfaceRemoveWorkerOnElan(elanInstanceName, elanInstance, interfaceName, interfaceInfo, elanInterfaceManager);
jobCoordinator.enqueueJob(elanInstanceName, removeWorker, ElanConstants.JOB_MAX_RETRIES);
}
use of org.opendaylight.genius.interfacemanager.globals.InterfaceInfo in project netvirt by opendaylight.
the class ElanPacketInHandler method tryAndRemoveInvalidMacEntry.
/*
* Though this method is a little costlier because it uses try-catch
* construct, it is used only in rare scenarios like MAC movement or invalid
* Static MAC having been added on a wrong ELAN.
*/
private void tryAndRemoveInvalidMacEntry(String elanName, MacEntry macEntry) {
ElanInstance elanInfo = elanInstanceCache.get(elanName).orNull();
if (elanInfo == null) {
LOG.warn("MAC {} is been added (either statically or dynamically) for an invalid Elan {}. " + "Manual cleanup may be necessary", macEntry.getMacAddress(), elanName);
return;
}
InterfaceInfo oldInterfaceLport = interfaceManager.getInterfaceInfo(macEntry.getInterface());
if (oldInterfaceLport == null) {
LOG.warn("MAC {} is been added (either statically or dynamically) on an invalid Logical Port {}. " + "Manual cleanup may be necessary", macEntry.getMacAddress(), macEntry.getInterface());
return;
}
ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> elanUtils.deleteMacFlows(elanInfo, oldInterfaceLport, macEntry, tx)), LOG, "Error deleting invalid MAC entry");
elanL2GatewayUtils.removeMacsFromElanExternalDevices(elanInfo, Collections.singletonList(macEntry.getMacAddress()));
}
use of org.opendaylight.genius.interfacemanager.globals.InterfaceInfo in project netvirt by opendaylight.
the class EtreeInterfaceGet method displayInterfaces.
private void displayInterfaces(ElanInstance elanInstance, List<String> interfaceList) {
if (!interfaceList.isEmpty()) {
for (String elanInterface : interfaceList) {
InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(elanInterface);
EtreeInterface etreeInterface = elanProvider.getEtreeInterfaceByElanInterfaceName(elanInterface);
if (interfaceInfo != null) {
session.getConsole().println(String.format(ElanCLIUtils.ETREE_INTERFACE_CLI_FORMAT, elanInstance.getElanInstanceName() + "/" + elanInstance.getElanTag(), elanInterface + "/" + interfaceInfo.getInterfaceTag(), interfaceInfo.getOpState(), interfaceInfo.getAdminState(), etreeInterface.getEtreeInterfaceType().getName()));
}
}
}
}
use of org.opendaylight.genius.interfacemanager.globals.InterfaceInfo in project netvirt by opendaylight.
the class StatisticsImpl method createElementCountersResult.
private CounterResultDataStructure createElementCountersResult(CounterRequests counterRequest) {
ElementCountersRequest ecr = createElementCounterRequest(counterRequest.getPortId(), counterRequest.getLportTag(), counterRequest.getDpn(), ElementCountersDirection.valueOf(counterRequest.getTrafficDirection()), counterRequest.getFilters()).iterator().next();
BigInteger dpId = getDpn(ecr.getPortId());
InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(ecr.getPortId());
if (interfaceInfo == null) {
return null;
}
int lportTag = interfaceInfo.getInterfaceTag();
List<MatchInfoBase> matches = CountersServiceUtils.getCounterFlowMatch(ecr, lportTag, ElementCountersDirection.valueOf(counterRequest.getTrafficDirection()));
Match match = MDSALUtil.buildMatches(matches);
return counterRetriever.getSwitchFlowCountersDirect(dpId, match);
}
use of org.opendaylight.genius.interfacemanager.globals.InterfaceInfo in project netvirt by opendaylight.
the class ElanServiceTest method checkDmacSameDPN.
@Test
public void checkDmacSameDPN() throws Exception {
// Create Elan instance
createElanInstance(ExpectedObjects.ELAN1, ExpectedObjects.ELAN1_SEGMENT_ID);
awaitForElanTag(ExpectedObjects.ELAN1);
// Add Elan interface in DPN1
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);
// Read DMAC Flow in DPN1
String flowId = new StringBuffer().append(NwConstants.ELAN_DMAC_TABLE).append(actualElanInstances.getElanTag()).append(DPN1_ID).append(interfaceInfo.getInterfaceTag()).append(interfaceInfo.getMacAddress()).toString();
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);
Flow expected = ExpectedObjects.checkDmacOfSameDpn(flowId, interfaceInfo, actualElanInstances);
AssertDataObjects.assertEqualBeans(getSortedActions(expected), getSortedActions(flowDst));
}
Aggregations