use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs 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.ParentRefs 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);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs in project genius by opendaylight.
the class VlanMemberConfigListener method addVlanMember.
private void addVlanMember(Interface added) {
ParentRefs parentRefs = added.getAugmentation(ParentRefs.class);
if (parentRefs == null) {
return;
}
String lowerLayerIf = parentRefs.getParentInterface();
if (lowerLayerIf.equals(added.getName())) {
LOG.error("Attempt to add Vlan Trunk-Member {} with same parent interface name.", added);
return;
}
coordinator.enqueueJob(lowerLayerIf, () -> ovsVlanMemberConfigAddHelper.addConfiguration(parentRefs, added), IfmConstants.JOB_MAX_RETRIES);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs in project genius by opendaylight.
the class HwVTEPConfigListener method add.
@Override
public void add(@Nonnull Interface newInterface) {
// HwVTEPs support only VXLAN
IfTunnel ifTunnel = newInterface.getAugmentation(IfTunnel.class);
if (ifTunnel != null && ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeVxlan.class)) {
ParentRefs parentRefs = newInterface.getAugmentation(ParentRefs.class);
if (parentRefs != null && parentRefs.getNodeIdentifier() != null) {
LOG.debug("Received HwVTEP Interface Add Event: {}", newInterface.getName());
LOG.trace("Received HwVTEP Interface Add Event: {}", newInterface);
for (NodeIdentifier nodeIdentifier : parentRefs.getNodeIdentifier()) {
if (SouthboundUtils.HWVTEP_TOPOLOGY.equals(nodeIdentifier.getTopologyId())) {
coordinator.enqueueJob(newInterface.getName(), () -> HwVTEPInterfaceConfigAddHelper.addConfiguration(txRunner, createPhysicalSwitchInstanceIdentifier(nodeIdentifier.getNodeId()), createGlobalNodeInstanceIdentifier(nodeIdentifier.getNodeId()), newInterface, ifTunnel), IfmConstants.JOB_MAX_RETRIES);
}
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs in project genius by opendaylight.
the class HwVTEPConfigListener method update.
@Override
public void update(@Nonnull Interface originalInterface, @Nonnull Interface updatedInterface) {
// HwVTEPs support only VXLAN
IfTunnel ifTunnel = originalInterface.getAugmentation(IfTunnel.class);
if (ifTunnel != null && ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeVxlan.class)) {
ParentRefs parentRefs = originalInterface.getAugmentation(ParentRefs.class);
if (parentRefs != null && parentRefs.getNodeIdentifier() != null) {
LOG.debug("Received HwVTEP Interface Update Event: {}", originalInterface.getName());
LOG.trace("Received HwVTEP Interface Update Event: updatedInterface: {}, OriginalInterface: {}", updatedInterface, originalInterface);
for (NodeIdentifier nodeIdentifier : parentRefs.getNodeIdentifier()) {
if (SouthboundUtils.HWVTEP_TOPOLOGY.equals(nodeIdentifier.getTopologyId())) {
coordinator.enqueueJob(originalInterface.getName(), () -> HwVTEPInterfaceConfigUpdateHelper.updateConfiguration(txRunner, createPhysicalSwitchInstanceIdentifier(nodeIdentifier.getNodeId()), createGlobalNodeInstanceIdentifier(nodeIdentifier.getNodeId()), updatedInterface, ifTunnel), IfmConstants.JOB_MAX_RETRIES);
}
}
}
}
}
Aggregations