Konstantinos Kanonakis | 5de5353 | 2016-07-06 16:31:08 -0500 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.ecord.carrierethernet.app; |
| 17 | |
Konstantinos Kanonakis | 5de5353 | 2016-07-06 16:31:08 -0500 | [diff] [blame] | 18 | import org.onlab.packet.VlanId; |
Konstantinos Kanonakis | 5de5353 | 2016-07-06 16:31:08 -0500 | [diff] [blame] | 19 | import org.onosproject.net.ConnectPoint; |
Konstantinos Kanonakis | 5de5353 | 2016-07-06 16:31:08 -0500 | [diff] [blame] | 20 | |
| 21 | import static com.google.common.base.MoreObjects.toStringHelper; |
Konstantinos Kanonakis | 5de5353 | 2016-07-06 16:31:08 -0500 | [diff] [blame] | 22 | |
| 23 | /** |
| 24 | * Representation of a Generic Carrier Ethernet NI. |
Konstantinos Kanonakis | 9cfbf4d | 2016-07-18 19:04:08 -0500 | [diff] [blame] | 25 | * Class is only meant to be used for establishing forwarding in CarrierEthernetPacketNodeManagers |
Konstantinos Kanonakis | 5de5353 | 2016-07-06 16:31:08 -0500 | [diff] [blame] | 26 | */ |
Yuta HIGUCHI | dbd2fec | 2017-02-01 16:34:38 -0800 | [diff] [blame^] | 27 | public class CarrierEthernetGenericNi extends CarrierEthernetNetworkInterface<CarrierEthernetGenericNi> { |
Konstantinos Kanonakis | 5de5353 | 2016-07-06 16:31:08 -0500 | [diff] [blame] | 28 | |
| 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 HIGUCHI | dbd2fec | 2017-02-01 16:34:38 -0800 | [diff] [blame^] | 49 | @Override |
Konstantinos Kanonakis | 5de5353 | 2016-07-06 16:31:08 -0500 | [diff] [blame] | 50 | 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 Kanonakis | 9cfbf4d | 2016-07-18 19:04:08 -0500 | [diff] [blame] | 74 | /** |
| 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 HIGUCHI | dbd2fec | 2017-02-01 16:34:38 -0800 | [diff] [blame^] | 97 | public boolean validateEcNi(CarrierEthernetGenericNi gni) { |
| 98 | return true; |
| 99 | } |
Konstantinos Kanonakis | 9cfbf4d | 2016-07-18 19:04:08 -0500 | [diff] [blame] | 100 | |
Konstantinos Kanonakis | 5de5353 | 2016-07-06 16:31:08 -0500 | [diff] [blame] | 101 | @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 | } |