blob: 63523041c66278c5b50e7913d6aecfe84f8cbe80 [file] [log] [blame]
Konstantinos Kanonakis5de53532016-07-06 16:31:08 -05001/*
2 * Copyright 2016 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.ecord.carrierethernet.app;
17
Konstantinos Kanonakis5de53532016-07-06 16:31:08 -050018import org.onlab.packet.VlanId;
Konstantinos Kanonakis5de53532016-07-06 16:31:08 -050019import org.onosproject.net.ConnectPoint;
Konstantinos Kanonakis5de53532016-07-06 16:31:08 -050020
21import static com.google.common.base.MoreObjects.toStringHelper;
Konstantinos Kanonakis5de53532016-07-06 16:31:08 -050022
23/**
24 * Representation of a Generic Carrier Ethernet NI.
Konstantinos Kanonakis9cfbf4d2016-07-18 19:04:08 -050025 * Class is only meant to be used for establishing forwarding in CarrierEthernetPacketNodeManagers
Konstantinos Kanonakis5de53532016-07-06 16:31:08 -050026 */
Yuta HIGUCHIdbd2fec2017-02-01 16:34:38 -080027public class CarrierEthernetGenericNi extends CarrierEthernetNetworkInterface<CarrierEthernetGenericNi> {
Konstantinos Kanonakis5de53532016-07-06 16:31:08 -050028
29 public enum Role {
30
31 NONE("None");
32
33 private String value;
34
35 Role(String value) {
36 this.value = value;
37 }
38
39 @Override
40 public String toString() {
41 return value;
42 }
43 }
44
45 public CarrierEthernetGenericNi(ConnectPoint connectPoint, String uniCfgId) {
46 super(connectPoint, Type.GENERIC, uniCfgId);
47 }
48
Yuta HIGUCHIdbd2fec2017-02-01 16:34:38 -080049 @Override
Konstantinos Kanonakis5de53532016-07-06 16:31:08 -050050 public Role role() {
51 return Role.NONE;
52 }
53
54 /**
55 * Always returns null, since CE-VLAN IDs are not associated with Generic NIs.
56 *
57 * @return null
58 */
59 @Override
60 public VlanId ceVlanId() {
61 return null;
62 }
63
64 /**
65 * Always returns null, since S-TAGs are not associated with Generic NIs.
66 *
67 * @return null
68 */
69 @Override
70 public VlanId sVlanId() {
71 return null;
72 }
73
Konstantinos Kanonakis9cfbf4d2016-07-18 19:04:08 -050074 /**
75 * Dummy implementation of abstract method (for generic NI type there is no concept of EVC vs. global NIs).
76 *
77 * @param gni a generic NI
78 */
79 @Override
80 public void addEcNi(CarrierEthernetGenericNi gni) {}
81
82 /**
83 * Dummy implementation of abstract method (for generic NI type there is no concept of EVC vs. global NIs).
84 *
85 * @param gni a generic NI
86 */
87 @Override
88 public void removeEcNi(CarrierEthernetGenericNi gni) {}
89
90 /**
91 * Dummy implementation of abstract method (for generic NI type there is no concept of EVC vs. global NIs).
92 *
93 * @param gni a generic NI
94 * @return true
95 */
96 @Override
Yuta HIGUCHIdbd2fec2017-02-01 16:34:38 -080097 public boolean validateEcNi(CarrierEthernetGenericNi gni) {
98 return true;
99 }
Konstantinos Kanonakis9cfbf4d2016-07-18 19:04:08 -0500100
Konstantinos Kanonakis5de53532016-07-06 16:31:08 -0500101 @Override
102 public String toString() {
103
104 return toStringHelper(this)
105 .add("id", this.id)
106 .add("cfgId", this.cfgId)
107 .add("refCount", refCount)
108 .add("capacity", this.capacity)
109 .add("usedCapacity", this.usedCapacity).toString();
110 }
111
112}