use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan in project genius by opendaylight.
the class OvsInterfaceConfigRemoveHelper method removeVlanConfiguration.
private void removeVlanConfiguration(ParentRefs parentRefs, String interfaceName, IfL2vlan ifL2vlan, WriteTransaction tx, List<ListenableFuture<Void>> futures) {
if (parentRefs == null || ifL2vlan == null || IfL2vlan.L2vlanMode.Trunk != ifL2vlan.getL2vlanMode() && IfL2vlan.L2vlanMode.Transparent != ifL2vlan.getL2vlanMode()) {
return;
}
LOG.info("removing vlan configuration for interface {}", interfaceName);
interfaceManagerCommonUtils.deleteInterfaceStateInformation(interfaceName, tx);
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceManagerCommonUtils.getInterfaceState(interfaceName);
if (ifState == null) {
LOG.debug("could not fetch interface state corresponding to {}, probably already removed as part of port " + "removal event, proceeding with remaining config cleanups", interfaceName);
}
cleanUpInterfaceWithUnknownState(interfaceName, parentRefs, null, tx);
BigInteger dpId = IfmUtil.getDpnFromInterface(ifState);
FlowBasedServicesUtils.removeIngressFlow(interfaceName, dpId, txRunner, futures);
interfaceManagerCommonUtils.deleteParentInterfaceEntry(parentRefs.getParentInterface());
// For Vlan-Trunk Interface, remove the trunk-member operstates as
// well...
InterfaceParentEntry interfaceParentEntry = interfaceMetaUtils.getInterfaceParentEntryFromConfigDS(interfaceName);
if (interfaceParentEntry == null || interfaceParentEntry.getInterfaceChildEntry() == null) {
return;
}
VlanMemberStateRemoveWorker vlanMemberStateRemoveWorker = new VlanMemberStateRemoveWorker(txRunner, interfaceManagerCommonUtils, dpId, interfaceName, interfaceParentEntry);
coordinator.enqueueJob(interfaceName, vlanMemberStateRemoveWorker, IfmConstants.JOB_MAX_RETRIES);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan in project genius by opendaylight.
the class OvsInterfaceConfigUpdateHelper method portAttributesModified.
private static boolean portAttributesModified(Interface interfaceOld, Interface interfaceNew) {
ParentRefs parentRefsOld = interfaceOld.getAugmentation(ParentRefs.class);
ParentRefs parentRefsNew = interfaceNew.getAugmentation(ParentRefs.class);
if (checkAugmentations(parentRefsOld, parentRefsNew)) {
return true;
}
IfL2vlan ifL2vlanOld = interfaceOld.getAugmentation(IfL2vlan.class);
IfL2vlan ifL2vlanNew = interfaceNew.getAugmentation(IfL2vlan.class);
if (checkAugmentations(ifL2vlanOld, ifL2vlanNew)) {
return true;
}
IfTunnel ifTunnelOld = interfaceOld.getAugmentation(IfTunnel.class);
IfTunnel ifTunnelNew = interfaceNew.getAugmentation(IfTunnel.class);
if (checkAugmentations(ifTunnelOld, ifTunnelNew)) {
if (!ifTunnelNew.getTunnelDestination().equals(ifTunnelOld.getTunnelDestination()) || !ifTunnelNew.getTunnelSource().equals(ifTunnelOld.getTunnelSource()) || ifTunnelNew.getTunnelGateway() != null && ifTunnelOld.getTunnelGateway() != null && !ifTunnelNew.getTunnelGateway().equals(ifTunnelOld.getTunnelGateway())) {
return true;
}
}
return false;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan in project genius by opendaylight.
the class OvsVlanMemberConfigAddHelper method addConfiguration.
public List<ListenableFuture<Void>> addConfiguration(ParentRefs parentRefs, Interface interfaceNew) {
LOG.info("adding vlan member configuration for interface {}", interfaceNew.getName());
List<ListenableFuture<Void>> futures = new ArrayList<>();
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> interfaceManagerCommonUtils.createInterfaceChildEntry(parentRefs.getParentInterface(), interfaceNew.getName(), tx)));
InterfaceKey interfaceKey = new InterfaceKey(parentRefs.getParentInterface());
Interface ifaceParent = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
if (ifaceParent == null) {
LOG.info("Parent Interface: {} not found when adding child interface: {}", parentRefs.getParentInterface(), interfaceNew.getName());
return futures;
}
IfL2vlan parentIfL2Vlan = ifaceParent.getAugmentation(IfL2vlan.class);
if (parentIfL2Vlan == null || parentIfL2Vlan.getL2vlanMode() != IfL2vlan.L2vlanMode.Trunk) {
LOG.error("Parent Interface: {} not of trunk Type when adding trunk-member: {}", ifaceParent, interfaceNew);
return futures;
}
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceManagerCommonUtils.getInterfaceState(parentRefs.getParentInterface());
interfaceManagerCommonUtils.addStateEntry(interfaceNew.getName(), futures, ifState);
return futures;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan in project genius by opendaylight.
the class VlanMemberConfigListener method update.
@Override
public void update(@Nonnull Interface originalInterface, @Nonnull Interface updatedInterface) {
IfL2vlan ifL2vlanNew = updatedInterface.getAugmentation(IfL2vlan.class);
if (ifL2vlanNew == null) {
return;
}
IfL2vlan ifL2vlanOld = originalInterface.getAugmentation(IfL2vlan.class);
if (IfL2vlan.L2vlanMode.TrunkMember == ifL2vlanNew.getL2vlanMode() && IfL2vlan.L2vlanMode.Trunk == ifL2vlanOld.getL2vlanMode()) {
// Trunk subport add use case
addVlanMember(updatedInterface);
return;
} else if (IfL2vlan.L2vlanMode.Trunk == ifL2vlanNew.getL2vlanMode() && IfL2vlan.L2vlanMode.TrunkMember == ifL2vlanOld.getL2vlanMode()) {
// Trunk subport remove use case
removeVlanMember(originalInterface);
} else if (IfL2vlan.L2vlanMode.TrunkMember != ifL2vlanNew.getL2vlanMode()) {
return;
}
ParentRefs parentRefsNew = updatedInterface.getAugmentation(ParentRefs.class);
if (parentRefsNew == null) {
LOG.error("Configuration Error. Attempt to update Vlan Trunk-Member {} without a " + "parent interface", updatedInterface);
return;
}
String lowerLayerIf = parentRefsNew.getParentInterface();
if (lowerLayerIf.equals(updatedInterface.getName())) {
LOG.error("Configuration Error. Attempt to update Vlan Trunk-Member {} with same parent " + "interface name.", updatedInterface);
return;
}
coordinator.enqueueJob(lowerLayerIf, () -> ovsVlanMemberConfigUpdateHelper.updateConfiguration(parentRefsNew, originalInterface, ifL2vlanNew, updatedInterface), IfmConstants.JOB_MAX_RETRIES);
}
Aggregations