Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present 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.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service |
| 17 | .rev20160317.mseaunievcservice.mefservices.uni; |
| 18 | |
| 19 | import org.onosproject.drivers.microsemi.yang.UniSide; |
| 20 | import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.types |
| 21 | .rev20160229.mseatypes.ServiceListType; |
| 22 | import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.mseaunievcservice.evcperuniextensionattributes.FlowMapping; |
| 23 | import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service |
| 24 | .rev20160317.mseaunievcservice.mefservices.uni.evc.CustomEvcPerUni; |
| 25 | import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.mseaunievcservice.mefservices.uni.evc.evcperuni.EvcPerUnic; |
| 26 | import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.mseaunievcservice.mefservices.uni.evc.evcperuni.EvcPerUnin; |
| 27 | |
| 28 | /** |
| 29 | * A custom implementation of the DefaultEvc - especially its Builder. |
| 30 | * |
| 31 | * This allows the Evc to be modified after creation. These additions to the |
| 32 | * builder are necessary because in the EA1000 YANG model many different Open Flow |
| 33 | * flows can be associated with one EVC - each one has its own Ce-Vlan-Id and |
| 34 | * Flow Reference |
| 35 | */ |
| 36 | public class CustomEvc extends DefaultEvc { |
| 37 | |
| 38 | public static EvcBuilder builder(Evc evc) { |
| 39 | return new EvcBuilder(evc); |
| 40 | } |
| 41 | |
| 42 | public static class EvcBuilder extends DefaultEvc.EvcBuilder { |
| 43 | |
| 44 | /** |
| 45 | * Allow a builder to be constructed from an existing EVC |
| 46 | * @param evc An existing EVC |
| 47 | */ |
| 48 | public EvcBuilder(Evc evc) { |
| 49 | this.evcPerUni = evc.evcPerUni(); |
| 50 | this.evcStatus = evc.evcStatus(); |
| 51 | this.evcIndex = evc.evcIndex(); |
| 52 | this.mtuSize = evc.mtuSize(); |
| 53 | this.cevlanCosPreservation = evc.cevlanCosPreservation(); |
| 54 | this.cevlanIdPreservation = evc.cevlanIdPreservation(); |
| 55 | this.name = evc.name(); |
| 56 | this.yangEvcOpType = evc.yangEvcOpType(); |
| 57 | this.yangAugmentedInfoMap = evc.yangAugmentedInfoMap(); |
| 58 | this.name = evc.name(); |
| 59 | this.serviceType = evc.serviceType(); |
| 60 | this.selectLeafFlags = evc.selectLeafFlags(); |
| 61 | this.uniEvcId = evc.uniEvcId(); |
| 62 | this.valueLeafFlags = evc.valueLeafFlags(); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Method to allow ceVlanMap to be modified. |
| 67 | * @param additionalCeVlanMap An addition to the existing ceVlanMap |
| 68 | * @param side The Uni Side - Customer or Network |
| 69 | * @return The updated builder |
| 70 | */ |
| 71 | public EvcBuilder addToCeVlanMap(ServiceListType additionalCeVlanMap, UniSide side) { |
| 72 | evcPerUni = CustomEvcPerUni.builder(evcPerUni).addToCeVlanMap(additionalCeVlanMap, side).build(); |
| 73 | return this; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Method to allow the Flow Mapping list to be modified. |
| 78 | * @param fm the flow mapping |
| 79 | * @param side The Uni Side - Customer or Network |
| 80 | * @return The updated builder |
| 81 | */ |
| 82 | public EvcBuilder addToFlowMapping(FlowMapping fm, UniSide side) { |
| 83 | evcPerUni = CustomEvcPerUni.builder(evcPerUni).addToFlowMapping(fm, side).build(); |
| 84 | return this; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Method to allow an EVC side to be added. |
| 89 | * @param evcUniN An EVCPerUni object |
| 90 | * @return The updated builder |
| 91 | */ |
| 92 | public EvcBuilder addUniN(EvcPerUnin evcUniN) { |
| 93 | evcPerUni = CustomEvcPerUni.builder(evcPerUni).addUniN(evcUniN).build(); |
| 94 | return this; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Method to allow an EVC side to be added. |
| 99 | * @param evcUniC An EVCPerUni object |
| 100 | * @return The updated builder |
| 101 | */ |
| 102 | public EvcBuilder addUniC(EvcPerUnic evcUniC) { |
| 103 | evcPerUni = CustomEvcPerUni.builder(evcPerUni).addUniC(evcUniC).build(); |
| 104 | return this; |
| 105 | } |
| 106 | } |
| 107 | } |