blob: ed53593ee93a69cfd4de84335bc263713f606767 [file] [log] [blame]
Sean Condonfae8e662016-12-15 10:25:13 +00001/*
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 */
16package org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service
17 .rev20160317.mseaunievcservice.mefservices.uni.evc;
18
19import org.onosproject.drivers.microsemi.yang.UniSide;
20import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.types
21 .rev20160229.mseatypes.ServiceListType;
22import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.mseaunievcservice.evcperuniextensionattributes.FlowMapping;
23import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service
24 .rev20160317.mseaunievcservice.mefservices.uni.evc.evcperuni.CustomEvcPerUnic;
25import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service
26 .rev20160317.mseaunievcservice.mefservices.uni.evc.evcperuni.CustomEvcPerUnin;
27import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.mseaunievcservice.mefservices.uni.evc.evcperuni.EvcPerUnic;
28import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.mseaunievcservice.mefservices.uni.evc.evcperuni.EvcPerUnin;
29
30/**
31 * A custom implementation of the DefaultEvcPerUni - especially its Builder.
32 *
33 * This allows the EvcPerUni to be modified after creation. These additions to the
34 * builder are necessary because in the EA1000 YANG model the EvcPerUni side can
35 * be added at separate stages
36 */
37public class CustomEvcPerUni extends DefaultEvcPerUni {
38
39 public static EvcPerUniBuilder builder(EvcPerUni evcPerUni) {
40 return new EvcPerUniBuilder(evcPerUni);
41 }
42
43 public static class EvcPerUniBuilder extends DefaultEvcPerUni.EvcPerUniBuilder {
44
45 /**
46 * Allow a builder to be constructed from an existing EvcPerUni
47 * @param evcPerUni An existing EvcPerUni
48 */
49 public EvcPerUniBuilder(EvcPerUni evcPerUni) {
50 this.evcPerUnic = evcPerUni.evcPerUnic();
51 this.evcPerUnin = evcPerUni.evcPerUnin();
52 this.evcUniType = evcPerUni.evcUniType();
53 this.yangEvcPerUniOpType = evcPerUni.yangEvcPerUniOpType();
54 this.valueLeafFlags = evcPerUni.valueLeafFlags();
55 this.selectLeafFlags = evcPerUni.selectLeafFlags();
56 this.yangAugmentedInfoMap = evcPerUni.yangAugmentedInfoMap();
57 }
58
59 /**
60 * Method to allow ceVlanMap to be modified.
61 * @param additionalCeVlanMap An addition to the existing ceVlanMap
62 * @param side The Uni Side - Customer or Network
63 * @return The updated builder
64 */
65 public EvcPerUniBuilder addToCeVlanMap(ServiceListType additionalCeVlanMap, UniSide side) {
66 if (side == UniSide.NETWORK) {
67 evcPerUnin = CustomEvcPerUnin.builder(evcPerUnin).addToCeVlanMap(additionalCeVlanMap).build();
68 } else {
69 evcPerUnic = CustomEvcPerUnic.builder(evcPerUnic).addToCeVlanMap(additionalCeVlanMap).build();
70 }
71
72 return this;
73 }
74
75 /**
76 * Method to allow the Flow Mapping list to be modified.
77 * @param fm the flow mapping
78 * @param side The Uni Side - Customer or Network
79 * @return The updated builder
80 */
81 public EvcPerUniBuilder addToFlowMapping(FlowMapping fm, UniSide side) {
82 if (side == UniSide.NETWORK) {
83 evcPerUnin = CustomEvcPerUnin.builder(evcPerUnin).addToFlowMapping(fm).build();
84 } else {
85 evcPerUnic = CustomEvcPerUnic.builder(evcPerUnic).addToFlowMapping(fm).build();
86 }
87 return this;
88 }
89
90 /**
91 * Method to allow an EVC side to be added.
92 * @param evcUniN An EVCPerUni object
93 * @return The updated builder
94 */
95 public EvcPerUniBuilder addUniN(EvcPerUnin evcUniN) {
96 this.evcPerUnin = evcUniN;
97 return this;
98 }
99
100 /**
101 * Method to allow an EVC side to be added.
102 * @param evcUniC An EVCPerUni object
103 * @return The updated builder
104 */
105 public EvcPerUniBuilder addUniC(EvcPerUnic evcUniC) {
106 this.evcPerUnic = evcUniC;
107 return this;
108 }
109 }
110}