add a common folder for mutualized functions
[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 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.Interface;
14 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.InterfaceBuilder;
15
16 public interface OpenRoadmInterfaces {
17
18     /**
19      * This methods does an edit-config operation on the openROADM device in order
20      * to create the given interface.
21      *
22      * <p>
23      * Before posting the interface it checks if:
24      * 1. Interface with same name does not exist
25      * 2. If exists then admin state of interface is outOfState/Maintenance
26      * </p>
27      *
28      * @param ifBuilder Builder object containing the data to post.
29      *
30      */
31     void postInterface(String nodeId, InterfaceBuilder ifBuilder) throws OpenRoadmInterfaceException;
32
33     /**
34      * This private does a get on the interface subtree of the device with the
35      * interface name as the key and return the class corresponding to the interface
36      * type.
37      *
38      * @param interfaceName
39      *            Name of the interface
40      *
41      * @return Optional of Interface from datastore
42      */
43     Optional<Interface> getInterface(String nodeId, String interfaceName) throws OpenRoadmInterfaceException;
44
45     /**
46      * This methods does an edit-config operation on the openROADM device in order
47      * to delete the given interface.
48      *
49      * <p>
50      * Before deleting the method:
51      * 1. Checks if interface exists
52      * 2. If exists then changes the state of interface to outOfService
53      * </p>
54      *
55      * @param interfaceName
56      *            Name of the interface to delete.
57      */
58     void deleteInterface(String nodeId, String interfaceName) throws OpenRoadmInterfaceException;
59
60 }