Sync Common folder
[transportpce.git] / common / src / main / java / org / opendaylight / transportpce / common / openroadminterfaces / OpenRoadmInterfaces.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.openroadminterfaces;
10
11 import java.util.Optional;
12
13 public interface OpenRoadmInterfaces {
14
15     /**
16      * This methods does an edit-config operation on the openROADM device in
17      * order to create the given interface.
18      *
19      * <p>
20      * Before posting the interface it checks if: 1. Interface with same name
21      * does not exist 2. If exists then admin state of interface is
22      * outOfState/Maintenance
23      * </p>
24      *
25      * @param nodeId node ID
26      *
27      * @param ifBuilder Builder object containing the data to post.
28      *
29      * @throws OpenRoadmInterfaceException OpenRoadm Interface Exception
30      *
31      */
32     <T> void postInterface(String nodeId, T ifBuilder) throws OpenRoadmInterfaceException;
33
34     /**
35      * This methods does an edit-config operation on the openROADM device in
36      * order to manages the equipment-state status of the circuit pack on which
37      * OpenRoadmEthernet or OpenRoadmOch interfaces are created, according to
38      * OpenRoadm whitepaper. Concerns only XPDR node.
39      *
40      * @param nodeId node ID
41      * @param circuitPackName Circtuit-Pack name
42      * @param activate activate or not
43      *
44      * @throws OpenRoadmInterfaceException OpenRoadm Interface Exception
45      */
46     void postEquipmentState(String nodeId, String circuitPackName, boolean activate) throws OpenRoadmInterfaceException;
47
48     /**
49      * This private does a get on the interface subtree of the device with the
50      * interface name as the key and return the class corresponding to the
51      * interface type.
52      *
53      * @param nodeId node ID
54      *
55      * @param interfaceName
56      *            Name of the interface
57      *
58      * @return Optional of Interface from datastore
59      *
60      * @throws OpenRoadmInterfaceException OpenRoadm Interface Exception
61      */
62     <T> Optional<T> getInterface(String nodeId, String interfaceName) throws OpenRoadmInterfaceException;
63
64     /**
65      * This methods does an edit-config operation on the openROADM device in
66      * order to delete the given interface.
67      *
68      * <p>
69      * Before deleting the method: 1. Checks if interface exists 2. If exists
70      * then changes the state of interface to outOfService
71      * </p>
72      *
73      * @param nodeId node ID
74      *
75      * @param interfaceName
76      *            Name of the interface to delete.
77      *
78      * @throws OpenRoadmInterfaceException OpenRoadm Interface Exception
79      */
80     void deleteInterface(String nodeId, String interfaceName) throws OpenRoadmInterfaceException;
81
82 }