use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel in project genius by opendaylight.
the class SouthboundUtils method addStateEntry.
public static void addStateEntry(Interface interfaceInfo, IfTunnel ifTunnel, WriteTransaction transaction) {
LOG.debug("adding tep interface state for {}", interfaceInfo);
if (interfaceInfo == null) {
return;
}
OperStatus operStatus = OperStatus.Up;
AdminStatus adminStatus = AdminStatus.Up;
if (!interfaceInfo.isEnabled()) {
operStatus = OperStatus.Down;
}
List<String> childLowerLayerIfList = new ArrayList<>();
childLowerLayerIfList.add(0, SouthboundUtils.getTerminationPointKeyString(ifTunnel.getTunnelDestination().getIpv4Address().getValue()));
InterfaceBuilder ifaceBuilder = new InterfaceBuilder().setAdminStatus(adminStatus).setOperStatus(operStatus).setLowerLayerIf(childLowerLayerIfList);
ifaceBuilder.setType(interfaceInfo.getType());
InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface> ifStateId = IfmUtil.buildStateInterfaceId(interfaceInfo.getName());
ifaceBuilder.setKey(IfmUtil.getStateInterfaceKeyFromName(interfaceInfo.getName()));
transaction.put(LogicalDatastoreType.OPERATIONAL, ifStateId, ifaceBuilder.build(), true);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel in project genius by opendaylight.
the class OvsInterfaceConfigAddHelper method addConfiguration.
public List<ListenableFuture<Void>> addConfiguration(ParentRefs parentRefs, Interface interfaceNew) {
List<ListenableFuture<Void>> futures = new ArrayList<>();
// TODO Disentangle the transactions
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(configTx -> {
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(operTx -> {
IfTunnel ifTunnel = interfaceNew.getAugmentation(IfTunnel.class);
if (ifTunnel != null) {
addTunnelConfiguration(parentRefs, interfaceNew, ifTunnel, configTx, operTx, futures);
} else {
addVlanConfiguration(interfaceNew, parentRefs, configTx, operTx, futures);
}
}));
}));
return futures;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel in project genius by opendaylight.
the class OvsInterfaceConfigUpdateHelper method tunnelMonitoringAttributesModified.
private static boolean tunnelMonitoringAttributesModified(Interface interfaceOld, Interface interfaceNew) {
IfTunnel ifTunnelOld = interfaceOld.getAugmentation(IfTunnel.class);
IfTunnel ifTunnelNew = interfaceNew.getAugmentation(IfTunnel.class);
return checkAugmentations(ifTunnelOld, ifTunnelNew);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel in project genius by opendaylight.
the class InterfaceManagerTestUtil method updateTunnelMonitoringAttributes.
static void updateTunnelMonitoringAttributes(DataBroker dataBroker, String ifaceName) throws TransactionCommitFailedException {
InstanceIdentifier<Interface> tunnelInstanceIdentifier = IfmUtil.buildId(ifaceName);
InterfaceBuilder builder = new InterfaceBuilder().setKey(new InterfaceKey(ifaceName)).setName(ifaceName);
IfTunnel tunnel = new IfTunnelBuilder().setMonitorProtocol(TunnelMonitoringTypeBfd.class).setMonitorEnabled(true).build();
builder.addAugmentation(IfTunnel.class, tunnel);
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.merge(CONFIGURATION, tunnelInstanceIdentifier, builder.build());
tx.submit().checkedGet();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel in project genius by opendaylight.
the class InterfaceManagerTestUtil method buildInterface.
static Interface buildInterface(String ifName, String desc, boolean enabled, Object ifType, String parentInterface, IfL2vlan.L2vlanMode l2vlanMode) {
InterfaceBuilder builder = new InterfaceBuilder().setKey(new InterfaceKey(ifName)).setName(ifName).setDescription(desc).setEnabled(enabled).setType((Class<? extends InterfaceType>) ifType);
ParentRefs parentRefs = new ParentRefsBuilder().setParentInterface(parentInterface).build();
builder.addAugmentation(ParentRefs.class, parentRefs);
if (ifType.equals(L2vlan.class)) {
IfL2vlanBuilder ifL2vlanBuilder = new IfL2vlanBuilder().setL2vlanMode(l2vlanMode);
if (IfL2vlan.L2vlanMode.TrunkMember.equals(l2vlanMode)) {
ifL2vlanBuilder.setVlanId(new VlanId(100));
} else {
ifL2vlanBuilder.setVlanId(VlanId.getDefaultInstance("0"));
}
builder.addAugmentation(IfL2vlan.class, ifL2vlanBuilder.build());
} else if (ifType.equals(IfTunnel.class)) {
IfTunnel tunnel = new IfTunnelBuilder().setTunnelDestination(null).setTunnelGateway(null).setTunnelSource(null).setTunnelInterfaceType(null).build();
builder.addAugmentation(IfTunnel.class, tunnel);
}
return builder.build();
}
Aggregations