use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus in project genius by opendaylight.
the class OvsVlanMemberConfigUpdateHelper method updateConfiguration.
public List<ListenableFuture<Void>> updateConfiguration(ParentRefs parentRefsNew, Interface interfaceOld, IfL2vlan ifL2vlanNew, Interface interfaceNew) {
LOG.info("updating interface configuration for vlan memeber {} with parent-interface {}", interfaceNew.getName(), parentRefsNew.getParentInterface());
List<ListenableFuture<Void>> futures = new ArrayList<>();
ParentRefs parentRefsOld = interfaceOld.getAugmentation(ParentRefs.class);
InterfaceParentEntryKey interfaceParentEntryKey = new InterfaceParentEntryKey(parentRefsOld.getParentInterface());
InterfaceChildEntryKey interfaceChildEntryKey = new InterfaceChildEntryKey(interfaceOld.getName());
InterfaceChildEntry interfaceChildEntry = interfaceMetaUtils.getInterfaceChildEntryFromConfigDS(interfaceParentEntryKey, interfaceChildEntryKey);
if (interfaceChildEntry == null) {
futures.addAll(ovsVlanMemberConfigAddHelper.addConfiguration(interfaceNew.getAugmentation(ParentRefs.class), interfaceNew));
return futures;
}
IfL2vlan ifL2vlanOld = interfaceOld.getAugmentation(IfL2vlan.class);
if (ifL2vlanOld == null || ifL2vlanNew.getL2vlanMode() != ifL2vlanOld.getL2vlanMode()) {
LOG.error("Configuration Error. Vlan Mode Change of Vlan Trunk Member {} as new trunk member: {} is " + "not allowed.", interfaceOld, interfaceNew);
return futures;
}
if (vlanIdModified(ifL2vlanOld.getVlanId(), ifL2vlanNew.getVlanId()) || !parentRefsOld.getParentInterface().equals(parentRefsNew.getParentInterface())) {
LOG.info("vlan-id modified for interface {}", interfaceNew.getName());
futures.addAll(ovsVlanMemberConfigRemoveHelper.removeConfiguration(parentRefsOld, interfaceOld));
futures.addAll(ovsVlanMemberConfigAddHelper.addConfiguration(parentRefsNew, interfaceNew));
return futures;
}
if (Objects.equals(interfaceNew.isEnabled(), interfaceOld.isEnabled())) {
return futures;
}
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface pifState = interfaceManagerCommonUtils.getInterfaceState(parentRefsNew.getParentInterface());
if (pifState != null) {
OperStatus operStatus = interfaceNew.isEnabled() ? pifState.getOperStatus() : OperStatus.Down;
LOG.info("admin-state modified for interface {}", interfaceNew.getName());
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface> ifStateId = IfmUtil.buildStateInterfaceId(interfaceNew.getName());
InterfaceBuilder ifaceBuilder = new InterfaceBuilder();
ifaceBuilder.setOperStatus(operStatus);
ifaceBuilder.setKey(IfmUtil.getStateInterfaceKeyFromName(interfaceNew.getName()));
tx.merge(LogicalDatastoreType.OPERATIONAL, ifStateId, ifaceBuilder.build());
}));
}
return futures;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus in project genius by opendaylight.
the class OvsInterfaceStateAddHelper method addState.
private List<ListenableFuture<Void>> addState(NodeConnectorId nodeConnectorId, String interfaceName, long portNo, PhysAddress physAddress) {
LOG.info("Adding Interface State to Oper DS for interface: {}", interfaceName);
if (portNo == IfmConstants.INVALID_PORT_NO) {
LOG.trace("Cannot derive port number, not proceeding with Interface State " + "addition for interface: {}", interfaceName);
return null;
}
List<ListenableFuture<Void>> futures = new ArrayList<>();
Interface.OperStatus operStatus = Interface.OperStatus.Up;
Interface.AdminStatus adminStatus = Interface.AdminStatus.Up;
// Fetch the interface from config DS if exists
InterfaceKey interfaceKey = new InterfaceKey(interfaceName);
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface iface = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
if (InterfaceManagerCommonUtils.isTunnelPort(interfaceName) && !validateTunnelPortAttributes(nodeConnectorId, iface)) {
return futures;
}
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
Interface ifState = interfaceManagerCommonUtils.addStateEntry(iface, interfaceName, tx, physAddress, operStatus, adminStatus, nodeConnectorId);
// flow,and start tunnel monitoring
if (InterfaceManagerCommonUtils.isTunnelInterface(iface)) {
handleTunnelMonitoringAddition(futures, nodeConnectorId, ifState.getIfIndex(), iface, interfaceName, portNo);
return;
}
// install ingress flow if this is an l2vlan interface
if (InterfaceManagerCommonUtils.isVlanInterface(iface) && iface.isEnabled() && ifState.getOperStatus() == org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus.Up) {
BigInteger dpId = IfmUtil.getDpnFromNodeConnectorId(nodeConnectorId);
FlowBasedServicesUtils.installLportIngressFlow(dpId, portNo, iface, futures, txRunner, ifState.getIfIndex());
futures.add(FlowBasedServicesUtils.bindDefaultEgressDispatcherService(txRunner, iface, Long.toString(portNo), interfaceName, ifState.getIfIndex()));
}
}));
return futures;
}
Aggregations