<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-artifacts</artifactId>
- <version>7.0.3</version>
+ <version>7.0.4</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<properties>
<mdsal.version>13.0.1</mdsal.version>
- <netconf.version>7.0.3</netconf.version>
+ <netconf.version>7.0.4</netconf.version>
<transportpce.models.version>20.0.0-SNAPSHOT</transportpce.models.version>
<transportpce.db.host>localhost:3306</transportpce.db.host>
<transportpce.db.database>transportpce</transportpce.db.database>
<properties>
<mdsal.version>13.0.1</mdsal.version>
- <netconf.version>7.0.3</netconf.version>
+ <netconf.version>7.0.4</netconf.version>
<transportpce.models.version>20.0.0-SNAPSHOT</transportpce.models.version>
<skip.karaf.featureTest>false</skip.karaf.featureTest>
</properties>
<name>OpenDaylight :: transportpce</name>
<properties>
- <netconf.version>7.0.3</netconf.version>
+ <netconf.version>7.0.4</netconf.version>
<transportpce.models.version>20.0.0-SNAPSHOT</transportpce.models.version>
<configfile.directory>etc/opendaylight/karaf</configfile.directory>
<skip.karaf.featureTest>false</skip.karaf.featureTest>
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-artifacts</artifactId>
- <version>7.0.3</version>
+ <version>7.0.4</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-artifacts</artifactId>
- <version>7.0.3</version>
+ <version>7.0.4</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-artifacts</artifactId>
- <version>7.0.3</version>
+ <version>7.0.4</version>
<scope>import</scope>
<type>pom</type>
</dependency>
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectivityService;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectivityServiceKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.get.connectivity.service.list.output.Service;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.get.connectivity.service.list.output.ServiceBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.get.connectivity.service.list.output.ServiceKey;
import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
Map<ServiceKey, Service> serviceMap = new HashMap<>();
for (ConnectivityService connectivityService: connMap.values()) {
- Service service = new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.get.connectivity.service.list.output.ServiceBuilder(
- connectivityService).build();
+ Service service = new ServiceBuilder(connectivityService).build();
serviceMap.put(service.key(), service);
}
- return RpcResultBuilder.success(new GetConnectivityServiceListOutputBuilder().setService(serviceMap)
- .build()).buildFuture();
+ return RpcResultBuilder
+ .success(new GetConnectivityServiceListOutputBuilder().setService(serviceMap).build())
+ .buildFuture();
}
}
import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.transportpce.tapi.utils.TapiContext;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Uuid;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetLinkDetails;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetLinkDetailsInput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetLinkDetailsOutput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetLinkDetailsOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.get.link.details.output.LinkBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link;
import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
@Override
public ListenableFuture<RpcResult<GetLinkDetailsOutput>> invoke(GetLinkDetailsInput input) {
// TODO Auto-generated method stub
- Uuid topoUuid = input.getTopologyId();
// Link id: same as OR link id
- Uuid linkUuid = input.getLinkId();
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link link = this.tapiContext
- .getTapiLink(topoUuid, linkUuid);
+ Link link = this.tapiContext.getTapiLink(input.getTopologyId(), input.getLinkId());
if (link == null) {
LOG.error("Invalid TAPI link name");
return RpcResultBuilder.<GetLinkDetailsOutput>failed()
.withError(ErrorType.RPC, "Invalid Link name")
.buildFuture();
}
- LOG.info("debug link is : {}", link.getName().toString());
+ LOG.info("debug link is : {}", link.getName());
return RpcResultBuilder
.success(new GetLinkDetailsOutputBuilder().setLink(new LinkBuilder(link).build()).build())
.buildFuture();
import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.transportpce.tapi.utils.TapiContext;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Uuid;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetNodeDetails;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetNodeDetailsInput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetNodeDetailsOutput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetNodeDetailsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.get.node.details.output.NodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node;
import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
public ListenableFuture<RpcResult<GetNodeDetailsOutput>> invoke(GetNodeDetailsInput input) {
// TODO Auto-generated method stub
// TODO -> maybe we get errors when having CEPs?
- Uuid topoUuid = input.getTopologyId();
// Node id: if roadm -> ROADM+PHOTONIC_MEDIA. if xpdr -> XPDR-XPDR+DSR/OTSi
- Uuid nodeUuid = input.getNodeId();
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node = this.tapiContext
- .getTapiNode(topoUuid, nodeUuid);
+ Node node = this.tapiContext.getTapiNode(input.getTopologyId(), input.getNodeId());
if (node == null) {
LOG.error("Invalid TAPI node name");
return RpcResultBuilder.<GetNodeDetailsOutput>failed()
.withError(ErrorType.RPC, "Invalid Tapi Node name")
.buildFuture();
}
- return RpcResultBuilder.success(new GetNodeDetailsOutputBuilder()
- .setNode(new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.topology.rev221121.get.node.details.output.NodeBuilder(node).build())
- .build()).buildFuture();
+ return RpcResultBuilder
+ .success(new GetNodeDetailsOutputBuilder()
+ .setNode(new NodeBuilder(node).build())
+ .build())
+ .buildFuture();
}
}
import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.transportpce.tapi.utils.TapiContext;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Uuid;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetNodeEdgePointDetails;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetNodeEdgePointDetailsInput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.GetNodeEdgePointDetailsOutput;
public ListenableFuture<RpcResult<GetNodeEdgePointDetailsOutput>> invoke(GetNodeEdgePointDetailsInput input) {
// TODO Auto-generated method stub
// TODO -> maybe we get errors when having CEPs?
- Uuid topoUuid = input.getTopologyId();
// Node id: if roadm -> ROADMid+PHOTONIC_MEDIA. if xpdr -> XPDRid-XPDRnbr+DSR/OTSi
- Uuid nodeUuid = input.getNodeId();
// NEP id: if roadm -> ROADMid+PHOTONIC_MEDIA/MC/OTSiMC+TPid.
// if xpdr -> XPDRid-XPDRnbr+DSR/eODU/iODU/iOTSi/eOTSi/PHOTONIC_MEDIA+TPid
- Uuid nepUuid = input.getNodeEdgePointId();
- OwnedNodeEdgePoint nep = this.tapiContext.getTapiNEP(topoUuid, nodeUuid, nepUuid);
+ OwnedNodeEdgePoint nep =
+ this.tapiContext.getTapiNEP(input.getTopologyId(), input.getNodeId(), input.getNodeEdgePointId());
if (nep == null) {
LOG.error("Invalid TAPI nep name");
return RpcResultBuilder.<GetNodeEdgePointDetailsOutput>failed()
}
return RpcResultBuilder
.success(new GetNodeEdgePointDetailsOutputBuilder()
- .setNodeEdgePoint(new NodeEdgePointBuilder(nep).build()).build())
+ .setNodeEdgePoint(new NodeEdgePointBuilder(nep).build())
+ .build())
.buildFuture();
}
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.GetServiceInterfacePointDetailsInput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.GetServiceInterfacePointDetailsOutput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.GetServiceInterfacePointDetailsOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Uuid;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.get.service._interface.point.details.output.SipBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.tapi.context.ServiceInterfacePoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.tapi.context.ServiceInterfacePointKey;
import org.opendaylight.yangtools.yang.common.ErrorType;
@Override
public ListenableFuture<RpcResult<GetServiceInterfacePointDetailsOutput>> invoke(
GetServiceInterfacePointDetailsInput input) {
- Uuid sipUuid = input.getUuid();
Map<ServiceInterfacePointKey, ServiceInterfacePoint> sips =
this.tapiContext.getTapiContext().getServiceInterfacePoint();
if (sips == null || sips.isEmpty()) {
.withError(ErrorType.RPC, "No sips in datastore")
.buildFuture();
}
- if (!sips.containsKey(new ServiceInterfacePointKey(sipUuid))) {
+ var sipKey = new ServiceInterfacePointKey(input.getUuid());
+ if (!sips.containsKey(sipKey)) {
return RpcResultBuilder.<GetServiceInterfacePointDetailsOutput>failed()
.withError(ErrorType.RPC, "Sip doesnt exist in datastore")
.buildFuture();
}
- var outSip = new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.common.rev221121.get.service._interface.point.details.output.SipBuilder(
- sips.get(new ServiceInterfacePointKey(sipUuid)))
- .build();
return RpcResultBuilder
- .success(new GetServiceInterfacePointDetailsOutputBuilder().setSip(outSip).build())
+ .success(new GetServiceInterfacePointDetailsOutputBuilder()
+ .setSip(new SipBuilder(sips.get(sipKey)).build())
+ .build())
.buildFuture();
}
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.transportpce.common.InstanceIdentifiers;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.AdministrativeState;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Context;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.LayerProtocolName;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.LifecycleState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.OperationalState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroupKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.Rule;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.RuleBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.RuleKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.LinkKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context.Topology;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context.TopologyBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context.TopologyKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
@Override
public ListenableFuture<RpcResult<GetTopologyDetailsOutput>> invoke(GetTopologyDetailsInput input) {
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context.Topology topology;
- Uuid topologyUuidFull = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER.getBytes(
- Charset.forName("UTF-8"))).toString());
- if (input.getTopologyId().equals(topologyUuidFull)) {
- Context context = this.tapiContext.getTapiContext();
- Map<TopologyKey,
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context.Topology>
- topologyMap = context.augmentation(Context1.class).getTopologyContext().getTopology();
+ var topoId = input.getTopologyId();
+ Uuid topologyUuidFull = new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.T0_FULL_MULTILAYER.getBytes(Charset.forName("UTF-8")))
+ .toString());
+ if (topologyUuidFull.equals(topoId)) {
+ Map<TopologyKey, Topology> topologyMap =
+ this.tapiContext.getTapiContext().augmentation(Context1.class).getTopologyContext().getTopology();
if (topologyMap == null || !topologyMap.containsKey(new TopologyKey(topologyUuidFull))) {
- LOG.error("Topology {} not found in datastore", input.getTopologyId());
+ LOG.error("Topology {} not found in datastore", topoId);
return RpcResultBuilder.<GetTopologyDetailsOutput>failed()
.withError(ErrorType.RPC, "Invalid Topology name")
.buildFuture();
}
- topology = topologyMap.get(new TopologyKey(input.getTopologyId()));
- return RpcResultBuilder.success(new GetTopologyDetailsOutputBuilder()
- .setTopology(this.topologyUtils.transformTopology(topology))
- .build())
+ return RpcResultBuilder
+ .success(
+ new GetTopologyDetailsOutputBuilder()
+ .setTopology(
+ this.topologyUtils.transformTopology(
+ topologyMap.get(new TopologyKey(topoId))))
+ .build())
.buildFuture();
}
- Uuid topologyUuidTapiAbs = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_TAPI_MULTILAYER.getBytes(
- Charset.forName("UTF-8"))).toString());
- if (input.getTopologyId().equals(topologyUuidTapiAbs)) {
+ if (new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.T0_TAPI_MULTILAYER.getBytes(Charset.forName("UTF-8")))
+ .toString())
+ .equals(topoId)) {
try {
- LOG.info("Building TAPI Topology abstraction for {}", input.getTopologyId());
- topology = createAbsTopologyFromTapiTopo();
- return RpcResultBuilder.success(new GetTopologyDetailsOutputBuilder()
- .setTopology(this.topologyUtils.transformTopology(topology)).build())
+ LOG.info("Building TAPI Topology abstraction for {}", topoId);
+ return RpcResultBuilder
+ .success(
+ new GetTopologyDetailsOutputBuilder()
+ .setTopology(this.topologyUtils.transformTopology(createAbsTopologyFromTapiTopo()))
+ .build())
.buildFuture();
} catch (TapiTopologyException e) {
LOG.error("error building TAPI topology");
.buildFuture();
}
}
- Uuid topologyUuid100G = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.TPDR_100G.getBytes(
- Charset.forName("UTF-8"))).toString());
- Uuid topologyUuidAbs = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_MULTILAYER.getBytes(
- Charset.forName("UTF-8"))).toString());
- if (topologyUuid100G.equals(input.getTopologyId()) || topologyUuidAbs.equals(input.getTopologyId())) {
- try {
- LOG.info("Building TAPI Topology abstraction for {}", input.getTopologyId());
- topology = createAbstractedOtnTopology();
- if (input.getTopologyId().equals(topologyUuidAbs)) {
- return RpcResultBuilder.success(new GetTopologyDetailsOutputBuilder()
- .setTopology(this.topologyUtils.transformTopology(topology)).build())
- .buildFuture();
- }
- topology = createAbstracted100GTpdrTopology(topology);
- return RpcResultBuilder.success(new GetTopologyDetailsOutputBuilder()
- .setTopology(this.topologyUtils.transformTopology(topology)).build())
+ try {
+ if (new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.T0_MULTILAYER.getBytes(Charset.forName("UTF-8")))
+ .toString())
+ .equals(topoId)) {
+ LOG.info("Building TAPI Topology abstraction for {}", topoId);
+ return RpcResultBuilder
+ .success(
+ new GetTopologyDetailsOutputBuilder()
+ .setTopology(this.topologyUtils.transformTopology(createAbstractedOtnTopology()))
+ .build())
.buildFuture();
- } catch (TapiTopologyException e) {
- LOG.error("error building TAPI topology");
- return RpcResultBuilder.<GetTopologyDetailsOutput>failed()
- .withError(ErrorType.RPC, "Error building topology")
+ }
+ if (new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.TPDR_100G.getBytes(Charset.forName("UTF-8")))
+ .toString())
+ .equals(topoId)) {
+ LOG.info("Building TAPI Topology abstraction for {}", topoId);
+ return RpcResultBuilder
+ .success(
+ new GetTopologyDetailsOutputBuilder()
+ .setTopology(
+ this.topologyUtils.transformTopology(
+ createAbstracted100GTpdrTopology(createAbstractedOtnTopology())))
+ .build())
.buildFuture();
}
+ return RpcResultBuilder.<GetTopologyDetailsOutput>failed()
+ .withError(ErrorType.RPC, "Invalid Topology name")
+ .buildFuture();
+ } catch (TapiTopologyException e) {
+ LOG.error("error building TAPI topology");
+ return RpcResultBuilder.<GetTopologyDetailsOutput>failed()
+ .withError(ErrorType.RPC, "Error building topology")
+ .buildFuture();
}
- return RpcResultBuilder.<GetTopologyDetailsOutput>failed()
- .withError(ErrorType.RPC, "Invalid Topology name")
- .buildFuture();
}
- public org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context.Topology
- createAbstracted100GTpdrTopology(org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.topology.rev221121.topology.context.Topology topology) {
- List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> dsrNodes = topology
- .nonnullNode().values().stream()
- .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
- .collect(Collectors.toList());
+ public Topology createAbstracted100GTpdrTopology(Topology topology) {
List<OwnedNodeEdgePoint> nep100GTpdrList = new ArrayList<>();
- for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node2 : dsrNodes) {
+ for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node2 :
+ topology.nonnullNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .collect(Collectors.toList())) {
List<OwnedNodeEdgePoint> nepList = node2.getOwnedNodeEdgePoint().values().stream()
.filter(nep -> nep.getName().containsKey(new NameKey("100G-tpdr")))
.collect(Collectors.toList());
nep100GTpdrList.addAll(nepList);
}
- Name topoName = new NameBuilder().setValue(TapiStringConstants.TPDR_100G).setValueName("TAPI Topology Name")
+ Name topoName = new NameBuilder()
+ .setValue(TapiStringConstants.TPDR_100G)
+ .setValueName("TAPI Topology Name")
.build();
- Uuid topoUuid = new Uuid(
- UUID.nameUUIDFromBytes(TapiStringConstants.TPDR_100G.getBytes(Charset.forName("UTF-8"))).toString());
+ Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.TPDR_100G.getBytes(Charset.forName("UTF-8")))
+ .toString());
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node =
- createTapiNode(nep100GTpdrList, topoUuid);
- return new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.topology.rev221121.topology.context.TopologyBuilder()
- .setName(Map.of(topoName.key(), topoName)).setUuid(topoUuid).setNode(Map.of(node.key(), node))
- .setLayerProtocolName(Set.of(LayerProtocolName.DSR, LayerProtocolName.ETH)).build();
+ createTapiNode(nep100GTpdrList, topoUuid);
+ return new TopologyBuilder()
+ .setName(Map.of(topoName.key(), topoName))
+ .setUuid(topoUuid)
+ .setNode(Map.of(node.key(), node))
+ .setLayerProtocolName(Set.of(LayerProtocolName.DSR, LayerProtocolName.ETH))
+ .build();
}
- public org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context.Topology
- createAbstractedOtnTopology() throws TapiTopologyException {
+ public Topology createAbstractedOtnTopology() throws TapiTopologyException {
// read openroadm-topology
Network openroadmTopo = readTopology(InstanceIdentifiers.OVERLAY_NETWORK_II);
List<Link> linkList = new ArrayList<>();
= new HashMap<>();
Map<LinkKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link> tapiLinkList
= new HashMap<>();
- Uuid topoUuid = new Uuid(UUID
- .nameUUIDFromBytes(TapiStringConstants.T0_MULTILAYER.getBytes(Charset.forName("UTF-8"))).toString());
+ Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.T0_MULTILAYER.getBytes(Charset.forName("UTF-8")))
+ .toString());
ConvertORTopoToTapiTopo tapiAbstractFactory = new ConvertORTopoToTapiTopo(topoUuid, this.tapiLink);
ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topoUuid);
Iterator<Entry<String, List<String>>> it = networkPortMap.entrySet().iterator();
LOG.warn("Unable to abstract an ROADM infrasctructure from openroadm-topology");
}
if (otnTopo.augmentation(Network1.class) != null) {
- Map<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
- .ietf.network.topology.rev180226.networks.network.LinkKey, Link> otnLinkMap =
- otnTopo.augmentation(Network1.class).getLink();
- tapiAbstractFactory.convertLinks(otnLinkMap);
+ tapiAbstractFactory.convertLinks(otnTopo.augmentation(Network1.class).getLink());
tapiLinkList.putAll(tapiAbstractFactory.getTapiLinks());
}
- Name name = new NameBuilder().setValue(TapiStringConstants.T0_MULTILAYER).setValueName("TAPI Topology Name")
- .build();
- LOG.info("TOPOABSTRACTED : the list of node is as follows {}", tapiNodeList.toString());
+ Name name = new NameBuilder().setValue(
+ TapiStringConstants.T0_MULTILAYER).setValueName("TAPI Topology Name")
+ .build();
+ LOG.info("TOPOABSTRACTED : the list of node is as follows {}", tapiNodeList);
this.tapiSips.putAll(tapiAbstractFactory.getTapiSips());
- return new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.topology.rev221121.topology.context.TopologyBuilder()
- .setName(Map.of(name.key(), name)).setUuid(topoUuid).setNode(tapiNodeList)
+ return new TopologyBuilder()
+ .setName(Map.of(name.key(), name))
+ .setUuid(topoUuid)
+ .setNode(tapiNodeList)
.setLayerProtocolName(Set.of(LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.DIGITALOTN))
.setLink(tapiLinkList)
.build();
}
- public org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context.Topology
- createAbsTopologyFromTapiTopo() throws TapiTopologyException {
- Uuid refTopoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(Charset.forName("UTF-8"))).toString());
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context.Topology tapiFullTopo =
+ public Topology createAbsTopologyFromTapiTopo() throws TapiTopologyException {
+ Uuid refTopoUuid = new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.T0_FULL_MULTILAYER.getBytes(Charset.forName("UTF-8")))
+ .toString());
+ Topology tapiFullTopo =
this.tapiContext
.getTopologyContext().entrySet().stream().filter(topo -> topo.getKey().getUuid().equals(refTopoUuid))
.findAny().orElseThrow().getValue();
absTapiTopo.convertRoadmInfrastructure();
Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node>
- tapiNodeList = new HashMap<>();
- Map<LinkKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link>
- tapiLinkList = new HashMap<>();
- tapiNodeList.putAll(absTapiTopo.getTapiNodes());
- tapiLinkList.putAll(absTapiTopo.getTapiLinks());
+ tapiNodeList = new HashMap<>(absTapiTopo.getTapiNodes());
+ LOG.info("ABSTRACTED TAPI TOPOLOGY : the list of node is as follows {}", tapiNodeList);
Name name = new NameBuilder()
.setValue(TapiStringConstants.T0_MULTILAYER)
.setValueName("TAPI Topology Name")
.build();
- Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_TAPI_MULTILAYER
- .getBytes(Charset.forName("UTF-8"))).toString());
- LOG.info("ABSTRACTED TAPI TOPOLOGY : the list of node is as follows {}", tapiNodeList);
- return new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context
- .TopologyBuilder()
+ return new TopologyBuilder()
.setName(Map.of(name.key(), name))
- .setUuid(topoUuid)
+ .setUuid(
+ new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.T0_TAPI_MULTILAYER.getBytes(Charset.forName("UTF-8")))
+ .toString()))
.setNode(tapiNodeList)
.setLayerProtocolName(Set.of(LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.DIGITALOTN))
- .setLink(tapiLinkList)
+ .setLink(new HashMap<>(absTapiTopo.getTapiLinks()))
.build();
}
onepMap.put(ownedNodeEdgePoint.key(), ownedNodeEdgePoint);
}
Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(name.getValue().getBytes(Charset.forName("UTF-8"))).toString());
- return new NodeBuilder().setUuid(nodeUuid).setName(Map.of(name.key(), name))
+ return new NodeBuilder()
+ .setUuid(nodeUuid)
+ .setName(Map.of(name.key(), name))
.setLayerProtocolName(Set.of(LayerProtocolName.ETH))
- .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
- .setLifecycleState(LifecycleState.INSTALLED).setOwnedNodeEdgePoint(onepMap)
- .setNodeRuleGroup(createNodeRuleGroupFor100gTpdrNode(topoUuid, nodeUuid, nepList)).build();
+ .setAdministrativeState(AdministrativeState.UNLOCKED)
+ .setOperationalState(OperationalState.ENABLED)
+ .setLifecycleState(LifecycleState.INSTALLED)
+ .setOwnedNodeEdgePoint(onepMap)
+ .setNodeRuleGroup(createNodeRuleGroupFor100gTpdrNode(topoUuid, nodeUuid, nepList))
+ .build();
}
- private boolean checkTp(String nodeIdTopo, String nodeIdPortMap, TerminationPoint tp, List<Link> xpdOut,
- List<Link> xpdIn) {
- String networkLcp;
- if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERCLIENT)) {
- networkLcp = tp.augmentation(
+ private boolean checkTp(
+ String nodeIdTopo, String nodeIdPortMap, TerminationPoint tp, List<Link> xpdOut, List<Link> xpdIn) {
+ String networkLcp =
+ tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERCLIENT)
+ ? tp.augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1.class)
- .getAssociatedConnectionMapTp().iterator().next().getValue();
- } else {
- networkLcp = tp.getTpId().getValue();
+ .getAssociatedConnectionMapTp().iterator().next().getValue()
+ : tp.getTpId().getValue();
+ ListenableFuture<Optional<Mapping>> mappingOpt =
+ networkTransactionService.read(
+ LogicalDatastoreType.CONFIGURATION,
+ InstanceIdentifier.create(
+ org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.Network.class)
+ .child(Nodes.class, new NodesKey(nodeIdPortMap))
+ .child(Mapping.class, new MappingKey(networkLcp)));
+ if (!mappingOpt.isDone()) {
+ LOG.error("Impossible to get mapping of associated network port {} of tp {}",
+ networkLcp, tp.getTpId().getValue());
+ return false;
}
- @NonNull
- KeyedInstanceIdentifier<Mapping, MappingKey> pmIID = InstanceIdentifier.create(
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.Network.class)
- .child(Nodes.class, new NodesKey(nodeIdPortMap)).child(Mapping.class, new MappingKey(networkLcp));
- ListenableFuture<Optional<Mapping>> mappingOpt = networkTransactionService
- .read(LogicalDatastoreType.CONFIGURATION, pmIID);
- Mapping mapping = null;
- if (mappingOpt.isDone()) {
- try {
- mapping = mappingOpt.get().orElseThrow();
- } catch (InterruptedException | ExecutionException e) {
- LOG.error("Error getting mapping for {}", networkLcp, e);
- return false;
- }
- } else {
- LOG.error("Impossible to get mapping of associated network port {} of tp {}", networkLcp,
- tp.getTpId().getValue());
+ Mapping mapping;
+ try {
+ mapping = mappingOpt.get().orElseThrow();
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("Error getting mapping for {}", networkLcp, e);
return false;
}
- String networkPortDirection = mapping.getPortDirection();
long count = 0;
- switch (networkPortDirection) {
+ switch (mapping.getPortDirection()) {
case "bidirectional":
count += xpdOut.stream().filter(lk -> lk.getSource().getSourceNode().getValue().equals(nodeIdTopo)
&& lk.getSource().getSourceTp().getValue().equals(networkLcp)).count();
count += xpdIn.stream().filter(lk -> lk.getDestination().getDestNode().getValue().equals(nodeIdTopo)
&& lk.getDestination().getDestTp().getValue().equals(networkLcp)).count();
- return (count == 2);
+ return count == 2;
case "tx":
case "rx":
@Nullable
count += xpdOut.stream().filter(lk -> lk.getSource().getSourceNode().getValue().equals(nodeIdTopo)
&& lk.getSource().getSourceTp().getValue().equals(partnerLcp)).count();
}
- return (count == 2);
+ return count == 2;
default:
LOG.error("Invalid port direction for {}", networkLcp);
return false;
}
}
- private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupFor100gTpdrNode(Uuid topoUuid, Uuid nodeUuid,
- Collection<OwnedNodeEdgePoint> onepl) {
-
+ private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupFor100gTpdrNode(
+ Uuid topoUuid, Uuid nodeUuid, Collection<OwnedNodeEdgePoint> onepl) {
Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointKey,
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint> nepMap
= new HashMap<>();
for (OwnedNodeEdgePoint onep : onepl) {
- var nep = new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointBuilder()
+ var nep = new NodeEdgePointBuilder()
.setTopologyUuid(topoUuid)
.setNodeUuid(nodeUuid)
.setNodeEdgePointUuid(onep.key().getUuid())
.build();
nepMap.put(nep.key(), nep);
}
- Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupMap = new HashMap<>();
- Map<RuleKey, Rule> ruleList = new HashMap<>();
- Set<RuleType> ruleTypes = new HashSet<>();
- ruleTypes.add(RuleType.FORWARDING);
- Rule rule = new RuleBuilder().setLocalId("forward").setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
- .setRuleType(ruleTypes).build();
- ruleList.put(rule.key(), rule);
- NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder().setUuid(new Uuid(
- UUID.nameUUIDFromBytes(("rdm infra node rule group").getBytes(Charset.forName("UTF-8"))).toString()))
- .setRule(ruleList).setNodeEdgePoint(nepMap).build();
- nodeRuleGroupMap.put(nodeRuleGroup.key(), nodeRuleGroup);
- return nodeRuleGroupMap;
+ Rule rule = new RuleBuilder()
+ .setLocalId("forward")
+ .setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
+ .setRuleType(new HashSet<RuleType>(Set.of(RuleType.FORWARDING)))
+ .build();
+ NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes(
+ ("rdm infra node rule group").getBytes(Charset.forName("UTF-8")))
+ .toString()))
+ .setRule(new HashMap<RuleKey, Rule>(Map.of(rule.key(), rule)))
+ .setNodeEdgePoint(nepMap)
+ .build();
+ return new HashMap<NodeRuleGroupKey, NodeRuleGroup>(Map.of(nodeRuleGroup.key(), nodeRuleGroup));
}
}
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.link.NodeEdgePoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.link.NodeEdgePointBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.link.NodeEdgePointKey;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.InterRuleGroup;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.InterRuleGroupKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroup;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroupKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointKey;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPac;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPacBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstances;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstancesBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.risk.parameter.pac.RiskCharacteristic;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.risk.parameter.pac.RiskCharacteristicBuilder;
}
public void convertLinks(Map<
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
- .LinkKey,
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
- .Link> otnLinkMap) {
- List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
- .Link> otnLinkList = new ArrayList<>(otnLinkMap.values());
- Collections.sort(otnLinkList, (l1, l2) -> l1.getLinkId().getValue()
- .compareTo(l2.getLinkId().getValue()));
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+ .networks.network.LinkKey,
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+ .networks.network.Link> otnLinkMap) {
+ List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+ .networks.network.Link> otnLinkList = new ArrayList<>(otnLinkMap.values());
+ Collections.sort(otnLinkList, (l1, l2) -> l1.getLinkId().getValue().compareTo(l2.getLinkId().getValue()));
List<String> linksToNotConvert = new ArrayList<>();
LOG.info("creation of {} otn links", otnLinkMap.size() / 2);
- for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
- .Link otnlink : otnLinkList) {
- if (!linksToNotConvert.contains(otnlink.getLinkId().getValue())) {
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks
- .network.Link oppositeLink = otnLinkMap.get(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns
- .yang.ietf.network.topology.rev180226.networks.network.LinkKey(otnlink.augmentation(Link1.class)
- .getOppositeLink()));
-
- AdminStates oppLnkAdmState = null;
- State oppLnkOpState = null;
- String oppositeLinkId = null;
- if (oppositeLink != null) {
- oppLnkAdmState = oppositeLink.augmentation(Link1.class).getAdministrativeState();
- oppLnkOpState = oppositeLink.augmentation(Link1.class).getOperationalState();
- oppositeLinkId = oppositeLink.getLinkId().getValue();
- }
- String adminState =
- otnlink.augmentation(Link1.class).getAdministrativeState() == null
- || oppLnkAdmState == null
- ? null
+ for (var otnlink : otnLinkList) {
+ String otnlinkId = otnlink.getLinkId().getValue();
+ if (linksToNotConvert.contains(otnlinkId)) {
+ continue;
+ }
+ var otnlinkAug = otnlink.augmentation(Link1.class);
+ var oppositeLink = otnLinkMap.get(
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+ .networks.network.LinkKey(otnlinkAug.getOppositeLink()));
+ AdminStates oppLnkAdmState = null;
+ State oppLnkOpState = null;
+ String oppositeLinkId = null;
+ if (oppositeLink != null) {
+ var oppositeLinkAug = oppositeLink.augmentation(Link1.class);
+ oppLnkAdmState = oppositeLinkAug.getAdministrativeState();
+ oppLnkOpState = oppositeLinkAug.getOperationalState();
+ oppositeLinkId = oppositeLink.getLinkId().getValue();
+ }
+ // TODO: Handle not only OTU4 but also other cases
+ String prefix = otnlinkId.split("-")[0];
+ String tpsQual = prefix.equals("OTU4") ? TapiStringConstants.I_OTSI : TapiStringConstants.E_ODU;
+ LayerProtocolName layerProtocolName =
+ prefix.equals("OTU4") ? LayerProtocolName.PHOTONICMEDIA : LayerProtocolName.ODU;
+ var otnlinkSrc = otnlink.getSource();
+ var otnlinkDst = otnlink.getDestination();
+ Link tapLink = this.tapiLink.createTapiLink(
+ otnlinkSrc.getSourceNode().getValue(),
+ otnlinkSrc.getSourceTp().getValue(),
+ otnlinkDst.getDestNode().getValue(),
+ otnlinkDst.getDestTp().getValue(),
+ TapiStringConstants.OTN_XPDR_XPDR_LINK,
+ // nodesQual, nodesQual,
+ TapiStringConstants.XPDR, TapiStringConstants.XPDR,
+ tpsQual, tpsQual,
+ otnlinkAug.getAdministrativeState() == null || oppLnkAdmState == null ? null
: this.tapiLink.setTapiAdminState(
- otnlink.augmentation(Link1.class).getAdministrativeState(), oppLnkAdmState).getName();
- String operState = otnlink.augmentation(Link1.class).getOperationalState() == null
- || oppLnkOpState == null
- ? null
+ otnlinkAug.getAdministrativeState(), oppLnkAdmState).getName(),
+ otnlinkAug.getOperationalState() == null || oppLnkOpState == null ? null
: this.tapiLink.setTapiOperationalState(
- otnlink.augmentation(Link1.class).getOperationalState(), oppLnkOpState).getName();
- // TODO: Handle not only OTU4 but also other cases
- String prefix = otnlink.getLinkId().getValue().split("-")[0];
- String nodesQual = TapiStringConstants.XPDR;
- String tpsQual = prefix.equals("OTU4") ? TapiStringConstants.I_OTSI : TapiStringConstants.E_ODU;
- LayerProtocolName layerProtocolName = prefix.equals("OTU4") ? LayerProtocolName.PHOTONICMEDIA
- : LayerProtocolName.ODU;
-
- Link tapLink = this.tapiLink.createTapiLink(otnlink.getSource().getSourceNode().getValue(),
- otnlink.getSource().getSourceTp().getValue(), otnlink.getDestination().getDestNode().getValue(),
- otnlink.getDestination().getDestTp().getValue(), TapiStringConstants.OTN_XPDR_XPDR_LINK, nodesQual,
- nodesQual, tpsQual, tpsQual, adminState, operState, Set.of(layerProtocolName),
- Set.of(layerProtocolName.getName()), this.tapiTopoUuid);
- linksToNotConvert.add(oppositeLinkId);
- tapiLinks.put(tapLink.key(), tapLink);
- LOG.debug("Links converted are as follow {}", tapiLinks.toString());
- }
+ otnlinkAug.getOperationalState(), oppLnkOpState).getName(),
+ Set.of(layerProtocolName),
+ Set.of(layerProtocolName.getName()),
+ this.tapiTopoUuid);
+ linksToNotConvert.add(oppositeLinkId);
+ tapiLinks.put(tapLink.key(), tapLink);
+ LOG.debug("Links converted are as follow {}", tapiLinks);
}
}
public void convertRoadmInfrastructure() {
LOG.info("abstraction of the ROADM infrastructure towards a photonic node");
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.RDM_INFRA
- .getBytes(Charset.forName("UTF-8"))).toString());
+ Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.RDM_INFRA.getBytes(Charset.forName("UTF-8")))
+ .toString());
Name nodeName =
new NameBuilder().setValueName("otsi node name").setValue(TapiStringConstants.RDM_INFRA).build();
Name nodeName2 =
new NameBuilder().setValueName("roadm node name").setValue(TapiStringConstants.RDM_INFRA).build();
- Name nameNodeType = new NameBuilder().setValueName("Node Type")
- .setValue(OpenroadmNodeType.ROADM.getName()).build();
+ Name nameNodeType =
+ new NameBuilder().setValueName("Node Type").setValue(OpenroadmNodeType.ROADM.getName()).build();
Set<LayerProtocolName> nodeLayerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA);
- List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiPhotonicNodes
- = pruneTapiPhotonicNodes();
//At that stage, there is no Roadm in the tapiPhotonicNodes Map / only the transponders
- Map<String, String> photonicNepUuisMap = convertListNodeWithListNepToMapForUuidAndName(tapiPhotonicNodes);
+ Map<String, String> photonicNepUuisMap =
+ convertListNodeWithListNepToMapForUuidAndName(pruneTapiPhotonicNodes());
// nep creation for rdm infra abstraction node
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = createNepForRdmNode(photonicNepUuisMap.size());
// node rule group creation
var tapiFactory = new ConvertORToTapiTopology(this.tapiTopoUuid);
Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupMap
= tapiFactory.createAllNodeRuleGroupForRdmNode("T0ML", nodeUuid, null, onepMap.values());
- Map<InterRuleGroupKey, InterRuleGroup> interRuleGroupMap
- = tapiFactory.createInterRuleGroupForRdmNode("T0ML", nodeUuid, null,
- nodeRuleGroupMap.entrySet().stream().map(e -> e.getKey()).collect(Collectors.toList()));
-
// Empty random creation of mandatory fields for avoiding errors....
CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
.setCostAlgorithm("Restricted Shortest Path - RSP")
.setRiskCharacteristicName("risk characteristic")
.setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
.build();
- RiskParameterPac riskParamPac = new RiskParameterPacBuilder()
- .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
- .build();
// build RDM infra node abstraction
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node rdmNode = new NodeBuilder()
+ var rdmNode = new NodeBuilder()
.setUuid(nodeUuid)
.setName(Map.of(nodeName.key(), nodeName, nodeName2.key(), nodeName2, nameNodeType.key(), nameNodeType))
.setLayerProtocolName(nodeLayerProtocols)
.setLifecycleState(LifecycleState.INSTALLED)
.setOwnedNodeEdgePoint(onepMap)
.setNodeRuleGroup(nodeRuleGroupMap)
- .setInterRuleGroup(interRuleGroupMap)
+ .setInterRuleGroup(
+ tapiFactory.createInterRuleGroupForRdmNode("T0ML", nodeUuid, null,
+ nodeRuleGroupMap.entrySet().stream().map(e -> e.getKey()).collect(Collectors.toList())))
.setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
.setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
- .setRiskParameterPac(riskParamPac)
+ .setRiskParameterPac(
+ new RiskParameterPacBuilder()
+ .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
+ .build())
.build();
tapiNodes.put(rdmNode.key(), rdmNode);
// OTS link creation between photonic nodes and RDM infra abstraction node :
//rdmInfraNepUuisMap is a Map <ROADMnodeUuuid--NepUuid; ROADMnodeName--nepName> built from onepMap
//photonicNepUuisMap is a Map <TSPnodeUuuid--eNepUuid; TSPnodeName--nepName> built from TapiPhotonicNode
Map<String, String> rdmInfraNepUuisMap = convertListNodeWithListNepToMapForUuidAndName(List.of(rdmNode));
- if (photonicNepUuisMap.size() != rdmInfraNepUuisMap.size()) {
- LOG.warn("Unable to build OTS links between photonics nodes and RDM infrasctructure abstraction");
- } else {
+ if (photonicNepUuisMap.size() == rdmInfraNepUuisMap.size()) {
//Tapi OtsLinks are created between Neps corresponding to the eNEPs of transponders (existing network ports)
//and Generic NEPS with abstracted names created in the ROADM infrastructure corresponding to tps mirroring
//transponders NETWORK PORTs. There is a simplification here considering that any network port of
// TODO: Do not understand that we build OTS link without checking that existing transponder ports
//are effectively connected. Need some consolidation
createTapiOtsLinks(photonicNepUuisMap, rdmInfraNepUuisMap);
+ } else {
+ LOG.warn("Unable to build OTS links between photonics nodes and RDM infrasctructure abstraction");
}
}
pruneTapiPhotonicNodes() {
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node>
prunedTapiPhotonicNodes = new ArrayList<>();
- List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiPhotonicNodes
- = this.tapiNodes.values().stream()
- .filter(n -> n.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA))
- .collect(Collectors.toList());
- for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node
- : tapiPhotonicNodes) {
+ for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node :
+ this.tapiNodes.values().stream()
+ .filter(n -> n.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA))
+ .collect(Collectors.toList())) {
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepM = new HashMap<>();
for (Map.Entry<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> entry : node.getOwnedNodeEdgePoint().entrySet()) {
if (entry.getValue().getName().values().stream()
onepM.put(entry.getKey(), entry.getValue());
}
}
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node prunedNode
- = new NodeBuilder(node).setOwnedNodeEdgePoint(onepM).build();
- prunedTapiPhotonicNodes.add(prunedNode);
+ prunedTapiPhotonicNodes.add(new NodeBuilder(node).setOwnedNodeEdgePoint(onepM).build());
}
return prunedTapiPhotonicNodes;
}
private Map<String, String> convertListNodeWithListNepToMapForUuidAndName(
- List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> nodes) {
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> nodes) {
Map<String, String> uuidNameMap = new HashMap<>();
- for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node : nodes) {
+ for (var node : nodes) {
+ String nodeName = node.getName().get(new NameKey("otsi node name")).getValue();
+ String nodeUuid = node.getUuid().getValue();
for (OwnedNodeEdgePoint nep : node.nonnullOwnedNodeEdgePoint().values()) {
- String nodeUuid = node.getUuid().getValue();
- String nepUuid = nep.getUuid().getValue();
- String nodeName = node.getName().get(new NameKey("otsi node name")).getValue();
- String nepName = nep.getName().get(new NameKey(nep.getName().keySet().stream().findFirst()
- .orElseThrow()))
- .getValue();
- uuidNameMap.put(String.join("--", nodeUuid, nepUuid), String.join("--", nodeName, nepName));
+ uuidNameMap.put(
+ String.join("--", nodeUuid, nep.getUuid().getValue()),
+ String.join("--", nodeName,
+ nep.getName().get(new NameKey(nep.getName().keySet().stream().findFirst().orElseThrow()))
+ .getValue()));
}
}
return uuidNameMap;
private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> createNepForRdmNode(int nbNep) {
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
for (int i = 1; i <= nbNep; i++) {
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "roadm node", "nep", String.valueOf(i)))
- .getBytes(Charset.forName("UTF-8"))).toString());
Name nepName = new NameBuilder()
.setValueName("NodeEdgePoint name")
.setValue(new StringBuilder("NodeEdgePoint_").append(i).toString())
.build();
- List<SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
OwnedNodeEdgePoint onep = new OwnedNodeEdgePointBuilder()
- .setUuid(nepUuid)
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", "roadm node", "nep", String.valueOf(i))).getBytes(Charset.forName("UTF-8")))
+ .toString()))
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName.key(), nepName))
- .setSupportedCepLayerProtocolQualifierInstances(sclpqiList)
+ .setSupportedCepLayerProtocolQualifierInstances(
+ new ArrayList<>(List.of(
+ new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(1))
+ .build())))
.setDirection(Direction.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
.setLifecycleState(LifecycleState.INSTALLED)
}
private void createTapiOtsLinks(Map<String, String> photonicNepUuisMap, Map<String, String> rdmInfraNepUuisMap) {
- Iterator<Entry<String, String>> it1 = photonicNepUuisMap.entrySet().iterator();
Iterator<Entry<String, String>> it2 = rdmInfraNepUuisMap.entrySet().iterator();
- while (it1.hasNext()) {
- Map<NodeEdgePointKey, NodeEdgePoint> nepMap = new HashMap<>();
- Map.Entry<String, String> photonicEntry = it1.next();
+ for (Map.Entry<String, String> photonicEntry : photonicNepUuisMap.entrySet()) {
Map.Entry<String, String> rdmEntry = it2.next();
- Uuid sourceUuidTp = new Uuid(photonicEntry.getKey().split("--")[1]);
- Uuid sourceUuidNode = new Uuid(photonicEntry.getKey().split("--")[0]);
- Uuid destUuidTp = new Uuid(rdmEntry.getKey().split("--")[1]);
- Uuid destUuidNode = new Uuid(rdmEntry.getKey().split("--")[0]);
+ String photonicEntryKey = photonicEntry.getKey();
NodeEdgePoint sourceNep = new NodeEdgePointBuilder()
.setTopologyUuid(this.tapiTopoUuid)
- .setNodeUuid(sourceUuidNode)
- .setNodeEdgePointUuid(sourceUuidTp)
+ .setNodeUuid(new Uuid(photonicEntryKey.split("--")[0]))
+ .setNodeEdgePointUuid(new Uuid(photonicEntryKey.split("--")[1]))
.build();
- nepMap.put(sourceNep.key(), sourceNep);
+ String rdmEntryKey = rdmEntry.getKey();
NodeEdgePoint destNep = new NodeEdgePointBuilder()
.setTopologyUuid(this.tapiTopoUuid)
- .setNodeUuid(destUuidNode)
- .setNodeEdgePointUuid(destUuidTp)
+ .setNodeUuid(new Uuid(rdmEntryKey.split("--")[0]))
+ .setNodeEdgePointUuid(new Uuid(rdmEntryKey.split("--")[1]))
.build();
- nepMap.put(destNep.key(), destNep);
- Name linkName = new NameBuilder().setValueName("OTS link name")
- .setValue(String.join(" and ", photonicEntry.getValue(), rdmEntry.getValue()))
+ String linkNameValue = String.join(" and ", photonicEntry.getValue(), rdmEntry.getValue());
+ Name linkName = new NameBuilder()
+ .setValueName("OTS link name")
+ .setValue(linkNameValue)
.build();
Link otsLink = new LinkBuilder()
- .setUuid(new Uuid(
- UUID.nameUUIDFromBytes((String.join(" and ", photonicEntry.getValue(), rdmEntry.getValue()))
- .getBytes(Charset.forName("UTF-8")))
- .toString()))
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes(linkNameValue.getBytes(Charset.forName("UTF-8")))
+ .toString()))
.setName(Map.of(linkName.key(), linkName))
.setLayerProtocolName(Set.of(LayerProtocolName.PHOTONICMEDIA))
- .setNodeEdgePoint(nepMap)
+ .setNodeEdgePoint(
+ new HashMap<NodeEdgePointKey, NodeEdgePoint>(Map.of(
+ sourceNep.key(), sourceNep, destNep.key(), destNep)))
.setDirection(ForwardingDirection.BIDIRECTIONAL)
.build();
this.tapiLinks.put(otsLink.key(), otsLink);
*/
package org.opendaylight.transportpce.tapi.utils;
-import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.binding.api.DataObjectModification;
import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
import org.opendaylight.mdsal.binding.api.DataTreeModification;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Uuid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.tapi.rev230728.ServiceInterfacePoints;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.tapi.rev230728.service._interface.points.ServiceEndPoint;
import org.opendaylight.yangtools.yang.binding.DataObject;
public class TapiListener implements DataTreeChangeListener<ServiceInterfacePoints> {
private static final Logger LOG = LoggerFactory.getLogger(TapiListener.class);
+ private static final String SE_JAVA_INTF =
+ "interface org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.tapi.rev180928"
+ + ".service._interface.points.ServiceEndPoint";
@Override
public void onDataTreeChanged(@NonNull List<DataTreeModification<ServiceInterfacePoints>> changes) {
switch (rootSIP.modificationType()) {
case WRITE:
LOG.info("onDataTreeChanged in TapiListener : WRITE");
- ServiceInterfacePoints data = rootSIP.dataAfter();
- List<ServiceEndPoint> listSEP = new ArrayList<>(data.getServiceEndPoint().values());
MappingUtils.deleteMap();
- for (ServiceEndPoint sep : listSEP) {
+ for (ServiceEndPoint sep : rootSIP.dataAfter().getServiceEndPoint().values()) {
MappingUtils.addMapSEP(sep);
}
MappingUtils.afficheMap();
break;
case SUBTREE_MODIFIED:
LOG.info("onDataTreeChanged in TapiListener : SUBTREE_MODIFIED");
- Iterator<? extends DataObjectModification<? extends DataObject>> iterator = rootSIP
- .getModifiedChildren(ServiceEndPoint.class).iterator();
- while (iterator.hasNext()) {
- DataObjectModification<? extends DataObject> dom = iterator.next();
+ for (DataObjectModification<? extends DataObject> dom :
+ rootSIP.getModifiedChildren(ServiceEndPoint.class)) {
// to delete existing child entry
- if (dom.dataAfter() == null) {
- DataObject dataObject = dom.dataBefore();
- ServiceEndPoint sep = null;
- sep = (ServiceEndPoint) dataObject;
- Uuid uuid = sep.getUuid();
- MappingUtils.deleteMapEntry(uuid);
+ DataObject dataAfter = dom.dataAfter();
+ if (dataAfter == null) {
+ MappingUtils.deleteMapEntry(((ServiceEndPoint) dom.dataBefore()).getUuid());
MappingUtils.afficheMap();
- break;
+ continue;
}
-
// to add new child entry
- if (dom.dataType().toString().compareTo("interface org.opendaylight.yang.gen.v1.urn.opendayl"
- + "ight.params.xml.ns.yang.tapi.rev180928.service._interface.points.ServiceEndPoint") == 0
- && dom.dataBefore() == null) {
- DataObject dataObject = dom.dataAfter();
- ServiceEndPoint sep = null;
- sep = (ServiceEndPoint) dataObject;
- MappingUtils.addMapSEP(sep);
- MappingUtils.afficheMap();
- } else {
+ if (dom.dataBefore() != null || dom.dataType().toString().compareTo(SE_JAVA_INTF) != 0) {
LOG.error("data input type is not a valid 'service-end-point'");
+ continue;
}
- break;
+ MappingUtils.addMapSEP((ServiceEndPoint) dataAfter);
+ MappingUtils.afficheMap();
}
break;
case DELETE:
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-artifacts</artifactId>
- <version>7.0.3</version>
+ <version>7.0.4</version>
<scope>import</scope>
<type>pom</type>
</dependency>