Refactor SupportedIfCapability usage
[transportpce.git] / common / src / main / java / org / opendaylight / transportpce / common / mapping / PortMapping.java
1 /*
2  * Copyright © 2017 AT&T and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.transportpce.common.mapping;
10
11
12 import java.util.List;
13 import java.util.Map;
14 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping;
15 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mc.capabilities.McCapabilities;
16 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.Nodes;
17 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.org.openroadm.device.container.org.openroadm.device.OduSwitchingPools;
18 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.org.openroadm.device.container.org.openroadm.device.odu.switching.pools.non.blocking.list.PortList;
19 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
20 import org.opendaylight.yangtools.yang.common.Uint16;
21
22
23 public interface PortMapping {
24
25     PortMappingVersion221 getPortMappingVersion221();
26
27     /**
28      * This method creates logical to physical port mapping for a given device.
29      * Instead of parsing all the circuit packs/ports in the device, this methods
30      * does a selective read operation on degree/srg subtree to get circuit
31      * packs/ports that map to :
32      *
33      * <p>
34      * 1. DEGn-TTP-TX, DEGn-TTP-RX, DEGn-TTP-TXRX
35      *
36      * <p>
37      * 2. SRGn-PPp-TX, SRGn-PPp-RX, SRGn-PPp-TXRX
38      *
39      * <p>
40      * 3. LINEn
41      *
42      * <p>
43      * 4. CLNTn.
44      *
45      * <p>
46      * If the port is Mw it also store the OMS, OTS interface provisioned on the
47      * port. It skips the logical ports that are internal. If operation is
48      * successful the mapping gets stored in datastore corresponding to
49      * portmapping.yang data model.
50      *
51      * @param nodeId
52      *            node ID
53      * @param nodeVersion
54      *            node version
55      *
56      * @return true/false based on status of operation
57      */
58     boolean createMappingData(String nodeId, String nodeVersion);
59
60     /**
61      * This method removes all mapping data of a given node from the datastore
62      * after disconnecting ODL from a Netconf device.
63      *
64      * @param nodeId
65      *            node ID
66      */
67     void deletePortMappingNode(String nodeId);
68
69     /**
70      * This method for a given node's termination point returns the Mapping object
71      * based on portmapping.yang model stored in the MD-SAL data store which is
72      * created when the node is connected for the first time. The mapping object
73      * basically contains the following attributes of interest:
74      *
75      * <p>
76      * 1. Supporting circuit pack
77      *
78      * <p>
79      * 2. Supporting port
80      *
81      * <p>
82      * 3. Supporting OTS/OMS interface (if port on ROADM)
83      *
84      * @param nodeId
85      *            Unique Identifier for the node of interest.
86      * @param logicalConnPoint
87      *            Name of the logical point
88      *
89      * @return Result Mapping object if success otherwise null.
90      */
91     Mapping getMapping(String nodeId, String logicalConnPoint);
92
93     /**
94      * This method allows retrieving a Mapping object from the mapping list stored in
95      * the MD-SAL data store. The main interest is to retrieve the
96      * logical-connection-point associated with a given port on a supporting
97      * circuit-pack
98      *
99      * @param nodeId
100      *            Unique Identifier for the node of interest.
101      * @param circuitPackName
102      *            Name of the supporting circuit-pack
103      * @param portName
104      *            Name of the supporting port
105      *
106      * @return Result Mapping object if success otherwise null.
107      */
108     Mapping getMapping(String nodeId, String circuitPackName, String portName);
109
110     /**
111      * This method removes a given mapping data from the mapping list
112      * stored in the datastore while the Netconf device is already
113      * connected to the controller.
114      *
115      * @param nodeId
116      *            node ID
117      * @param logicalConnectionPoint
118      *            key of the mapping inside the mapping list
119      */
120     void deleteMapping(String nodeId, String logicalConnectionPoint);
121
122     /**
123      * This method, for a given node media channel-capabilities, returns the object
124      * based on portmapping.yang model stored in the MD-SAL data store which is
125      * created when the node is connected for the first time. The mapping object
126      * basically contains the following attributes of interest:
127      *
128      * <p>
129      * 1. slot width granularity
130      *
131      * <p>
132      * 2. center frequency granularity
133      *
134      * <p>
135      * 3. Supporting OMS interface (if port on ROADM)
136      *
137      * <p>
138      * 4. Supporting OTS interface (if port on ROADM)
139      *
140      * @param nodeId
141      *            Unique Identifier for the node of interest.
142      * @param mcLcp
143      *            Name of the MC-capability
144      *
145      * @return Result McCapabilities.
146      */
147     McCapabilities getMcCapbilities(String nodeId, String mcLcp);
148
149     /**
150      * This method for a given node, allows to update a specific mapping based on
151      * portmapping.yang model already stored in the MD-SAL data store, following
152      * some changes on the device port (creation of interface supported on this
153      * port, change of port admin state, etc).
154      *
155     * @param nodeId
156      *            Unique Identifier for the node of interest.
157      * @param mapping
158      *            Old mapping to be updated.
159      *
160      * @return Result true/false based on status of operation.
161      */
162     boolean updateMapping(String nodeId, Mapping mapping);
163
164     /**
165      * Returns all Mapping informations for a given ordm device. This method returns
166      * all Mapping informations already stored in the MD-SAL data store for a given
167      * openroadm device. Beyound the list of mappings, it gives access to general
168      * node information as its version or its node type, etc.
169      *
170      * @param nodeId
171      *            Unique Identifier for the node of interest.
172      *
173      * @return node data if success otherwise null.
174      */
175     Nodes getNode(String nodeId);
176
177     /**
178      * This method allows to update a port-mapping node with odu-connection-map data.
179      * This method is used for an otn xponder in version 7.1, when a device sends a
180      * change-notification advertising controller that odu-switching-pools containers
181      * have been populated inside its configuration
182      * (appears after creation of an OTSI-Group interface).
183      *
184      * @param nodeId
185      *            Unique Identifier for the node of interest.
186      * @param ospIID
187      *            Instance Identifier of the odu-switching-pools.
188      * @param nbliidMap
189      *            Map containing the non-blocking-list number as key,
190      *            and the list of Instance Identifier corresponding to each port-list
191      *            as value.
192      *
193      * @return Result true/false based on status of operation.
194      */
195     boolean updatePortMappingWithOduSwitchingPools(String nodeId, InstanceIdentifier<OduSwitchingPools> ospIID,
196         Map<Uint16, List<InstanceIdentifier<PortList>>> nbliidMap);
197
198     /**
199      * This method check the presence or not of a given node inside the PortMapping
200      * datastore.
201      *
202      * @param nodeId
203      *            Unique Identifier for the node of interest.
204      *
205      * @return Result true/false based on existance or not of a given node.
206      */
207     boolean isNodeExist(String nodeId);
208
209 }