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