Initial import of Microsemi Driver
Change-Id: I431d5f2c18e0b66a84c36273c3d9f0b84f223841
Added in BUCK files for building driver
Change-Id: I70681327f5b89f67e904c45d5974ab393652d51f
Corrected some syntax errors
Change-Id: I11150cc499c212005f80619e3900e747f1c23d96
Updated pom file to clean build
Change-Id: I6613ddc9e6802aa882e716cf04df210249870835
Added in utility functions for EA1000 Init
Change-Id: I51ffe0cf0daf9ffcea0e2479ee9982fcd1755440
Added YMS code to Microsemi Driver
Change-Id: I6f2a14e454c6909bf9e9f6025321c74c98c13c72
Updated driver to work with YMS and YCH
Change-Id: If7dbe3cd5bd1b6f902d09d6b2dc3895605d70f70
Implemented IetfSystemManager as a service and call on YMS as a service
Change-Id: If1c5e8482b1f53f578a3b0b770accd50024111cf
Moved YMS calls over in to Yang Service implementation
Change-Id: I044aad06f1ef7452bc48e88987787a683666cd72
improved unit test for IetfSystemManager
Change-Id: I48fbf831e7e5ca0e1ef3de8288e56da1b5ebb7a4
Major changes to IetfSystemManager to work in live system
Change-Id: I6e3aa118ba422151f314b9a666860d90905c9929
Added in retry mechanism for DeviceDescription to wait for YCH
Change-Id: If8e0f2c2f315ffd6db15627a11382a00217dd262
Added in implementation of MseaSaFiltering and unit tests
Change-Id: I34bf888e0e732bd4664d1fb8ef5abb679b1506fe
Updated driver with unit tests for MseaSaFiltering
Change-Id: I7ea2407a546622ff55d1ab21610c45697546d632
Modified removeFlowRules of Ea1000FlowRuleProgrammable
Change-Id: Ibb4a555f61887a8e6e42af588bb42f7b70f58efb
Added in manager for MseaUniEvc service with unit tests
Change-Id: Idc5853f46051548973f52a0659f7f88982ff960c
Implemented getFlowEntries() for EVCs from EA1000
Change-Id: Ie85dadfa7760f0b30a9bdf6ccd09cca9f097fff9
Added in translation of FlowRules in to EVC on EA1000
Change-Id: Icfb65171c3300c96b3ca4e18cbd327f0ed2190be
Added in handling of FlowRule deletion including complex ceVlanMaps
Change-Id: I7fd0bb0ef04d1b40e4b7d6a6db7f7ee662329780
Updated Service entries for new onos-yang-tools
Change-Id: I44e655202f3a45073e1e16f83737caed6e01afa8
Revert "Updated Service entries for new onos-yang-tools"
This reverts commit 642b550ef1de12ed59bad2eaa3a2da414d2e5e59.
Improved timeout mechanism for YANG model loading
Change-Id: If744ecd206372e822edf2b736c83226321a12256
Minor edits of EVC creation
Change-Id: Ib0a4763deaf6dce37625ba77f5095b39cd98272d
Added in CustomEvc and supporting classes
Change-Id: Iad60eb1bcd48d2aec55b894b2d419b51852c3b2f
Created CeVlanUtils to resolve loading problem
Change-Id: I0d63931ad2c5ad2725861ebc7dccc4d5fe7b9298
Modified startup check
Change-Id: I6e6bcfa7e615044cb08fe7ee2f8a6c8b89aabb21
Modified handlin of flow rules
Change-Id: I965a79c23298866122aeb94c6d9d584aafee3bd5
Fixed problem with ceVlanMap
Change-Id: If1458c35d0b95b5b25b6636f098292f9e91c06c6
Minor Pom edits
Change-Id: I5cefb18674aa04b1f50bd7e2306260c1c3ad3814
Commented out extension references in YANG files to avoid onos-yang-tools problems
Change-Id: I32fdb34c4f476f495fe28e75d0f410aaf14e2ec1
Corrected error in removing 0 in CeVlanMapUtils
Change-Id: I8cd1fd02788b81c2613364d5639ef6e090057f80
Changes in YMS to accomodate EA1000 driver
Change-Id: I6ae2b9bd2be49eae8d4ad2f929dfe3214c514550
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/IetfSystemNetconfService.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/IetfSystemNetconfService.java
new file mode 100644
index 0000000..7554350
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/IetfSystemNetconfService.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.drivers.microsemi.yang;
+
+import java.time.OffsetDateTime;
+
+import org.onosproject.netconf.NetconfException;
+import org.onosproject.netconf.NetconfSession;
+import org.onosproject.netconf.TargetConfig;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.system.rev20160505.ietfsystemmicrosemi.doupgradeandreboot.DoUpgradeAndRebootInput;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.system.rev20160505.ietfsystemmicrosemi.doupgradeandreboot.DoUpgradeAndRebootOutput;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.system.rev20160505.ietfsystemmicrosemi.pullupdatetarfromtftp.PullUpdateTarFromTftpInput;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.system.rev20160505.ietfsystemmicrosemi.readfromsyslog.ReadFromSyslogInput;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.system.rev20160505.ietfsystemmicrosemi.readfromsyslog.ReadFromSyslogOutput;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.system.rev20140806.IetfSystem;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.system.rev20140806.IetfSystemOpParam;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.system.rev20140806.ietfsystem.systemrestart.SystemRestartInput;
+
+/**
+ * Extension of ietfSystemService to include NETCONF sessions.
+ *
+ * This is manually extended and should be revised if the ietf-system.yang file changes
+ */
+public interface IetfSystemNetconfService {
+ /**
+ * Returns the attribute ietfSystem.
+ *
+ * @param ietfSystem value of ietfSystem
+ * @param session An active NETCONF session
+ * @return ietfSystem
+ * @throws NetconfException if the session has any error
+ */
+ IetfSystem getIetfSystem(IetfSystemOpParam ietfSystem, NetconfSession session) throws NetconfException;
+
+ /**
+ * Returns the result of the init query.
+ *
+ * @param session An active NETCONF session
+ * @return ietfSystem
+ * @throws NetconfException if the session has any error
+ */
+ IetfSystem getIetfSystemInit(NetconfSession session) throws NetconfException;
+
+ /**
+ * Sets the value to attribute ietfSystem.
+ *
+ * @param ietfSystem value of ietfSystem
+ * @param session An active NETCONF session
+ * @param ncDs datastore type running, startup or candidate
+ * @throws NetconfException if the session has any error
+ */
+ void setIetfSystem(IetfSystemOpParam ietfSystem, NetconfSession session, TargetConfig ncDs)
+ throws NetconfException;
+
+ /**
+ * Service interface of setCurrentDatetime.
+ *
+ * @param date input of service interface setCurrentDatetime
+ * @param session An active NETCONF session
+ * @throws NetconfException if the session has any error
+ */
+ void setCurrentDatetime(OffsetDateTime date, NetconfSession session) throws NetconfException;
+
+ /**
+ * Service interface of systemRestart.
+ *
+ * @param inputVar input of service interface systemRestart
+ * @param session An active NETCONF session
+ * @throws NetconfException if the session has any error
+ */
+ void systemRestart(SystemRestartInput inputVar, NetconfSession session) throws NetconfException;
+
+ /**
+ * Service interface of systemShutdown.
+ *
+ * @param session An active NETCONF session
+ * @throws NetconfException if the session has any error
+ */
+ void systemShutdown(NetconfSession session) throws NetconfException;
+
+ /**
+ * Service interface of doUpgradeAndReboot.
+ *
+ * @param inputVar input of service interface doUpgradeAndReboot
+ * @param session An active NETCONF session
+ * @return doUpgradeAndRebootOutput output of service interface doUpgradeAndReboot
+ * @throws NetconfException if the session has any error
+ */
+ DoUpgradeAndRebootOutput doUpgradeAndReboot(DoUpgradeAndRebootInput inputVar, NetconfSession session)
+ throws NetconfException;
+
+ /**
+ * Service interface of pullUpdateTarFromTftp.
+ *
+ * @param inputVar input of service interface pullUpdateTarFromTftp
+ * @param session An active NETCONF session
+ * @throws NetconfException if the session has any error
+ */
+ void pullUpdateTarFromTftp(PullUpdateTarFromTftpInput inputVar, NetconfSession session)
+ throws NetconfException;
+
+ /**
+ * Service interface of readFromSyslog.
+ *
+ * @param inputVar input of service interface readFromSyslog
+ * @param session An active NETCONF session
+ * @return readFromSyslogOutput output of service interface readFromSyslog
+ * @throws NetconfException if the session has any error
+ */
+ ReadFromSyslogOutput readFromSyslog(ReadFromSyslogInput inputVar, NetconfSession session)
+ throws NetconfException;
+
+}
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/MseaCfmNetconfService.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/MseaCfmNetconfService.java
new file mode 100644
index 0000000..cf391fa
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/MseaCfmNetconfService.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.drivers.microsemi.yang;
+
+import org.onosproject.event.ListenerService;
+import org.onosproject.netconf.NetconfException;
+import org.onosproject.netconf.NetconfSession;
+import org.onosproject.netconf.TargetConfig;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.MseaCfm;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.MseaCfmOpParam;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.mseacfm.MseaCfmEvent;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.mseacfm.MseaCfmEventListener;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.mseacfm.abortloopback.AbortLoopbackInput;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.mseacfm.transmitlinktrace.TransmitLinktraceInput;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.mseacfm.transmitlinktrace.TransmitLinktraceOutput;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.mseacfm.transmitloopback.TransmitLoopbackInput;
+
+/**
+ * Extension of mseaCfmService to include NETCONF sessions.
+ *
+ * This is manually extended and should be revised if the msea-cfm.yang,
+ * msea-soam-pm.yang or msea-soam-fm.yang files change
+ */
+public interface MseaCfmNetconfService extends ListenerService<MseaCfmEvent, MseaCfmEventListener> {
+
+ /**
+ * Returns attributes of MEP.
+ *
+ * @param mdName The name of the MD
+ * @param maName The name of the MA
+ * @param mepId The ID of the MEP
+ * @param session An active NETCONF session
+ * @return mseaCfm
+ * @throws NetconfException if the session has any error
+ */
+ MseaCfm getMepEssentials(String mdName, String maName, int mepId,
+ NetconfSession session) throws NetconfException;
+
+
+ /**
+ * Returns attributes of DM.
+ *
+ * @param mdName The name of the MD
+ * @param maName The name of the MA
+ * @param mepId The ID of the MEP
+ * @param dmId The Id of the Delay Measurement
+ * @param session An active NETCONF session
+ * @return mseaCfm
+ * @throws NetconfException if the session has any error
+ */
+ MseaCfm getSoamDm(String mdName, String maName, int mepId,
+ int dmId, NetconfSession session) throws NetconfException;
+
+ /**
+ * Sets the value to attribute mseaCfm.
+ *
+ * @param mseaCfm value of mseaCfm
+ * @param session An active NETCONF session
+ * @param targetDs one of running, candidate or startup
+ * @throws NetconfException if the session has any error
+ */
+ void setMseaCfm(MseaCfmOpParam mseaCfm, NetconfSession session, TargetConfig targetDs) throws NetconfException;
+
+ /**
+ * Service interface of transmitLoopback.
+ *
+ * @param inputVar input of service interface transmitLoopback
+ * @param session An active NETCONF session
+ * @throws NetconfException if the session has any error
+ */
+ void transmitLoopback(TransmitLoopbackInput inputVar, NetconfSession session) throws NetconfException;
+
+ /**
+ * Service interface of abortLoopback.
+ *
+ * @param inputVar input of service interface abortLoopback
+ * @param session An active NETCONF session
+ * @throws NetconfException if the session has any error
+ */
+ void abortLoopback(AbortLoopbackInput inputVar, NetconfSession session) throws NetconfException;
+
+ /**
+ * Service interface of transmitLinktrace.
+ *
+ * @param inputVar input of service interface transmitLinktrace
+ * @param session An active NETCONF session
+ * @return transmitLinktraceOutput output of service interface transmitLinktrace
+ * @throws NetconfException if the session has any error
+ */
+ TransmitLinktraceOutput transmitLinktrace(TransmitLinktraceInput inputVar, NetconfSession session)
+ throws NetconfException;
+}
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/MseaSaFilteringNetconfService.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/MseaSaFilteringNetconfService.java
new file mode 100644
index 0000000..9e35df0
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/MseaSaFilteringNetconfService.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.drivers.microsemi.yang;
+
+import org.onosproject.netconf.NetconfException;
+import org.onosproject.netconf.NetconfSession;
+import org.onosproject.netconf.TargetConfig;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.sa.filtering.rev20160412.MseaSaFiltering;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.sa.filtering.rev20160412.MseaSaFilteringOpParam;
+
+/**
+ * Extension of mseaSaFilteringService to include NETCONF sessions.
+ *
+ * This is manually extended and should be revised if the msea-sa-filtering.yang file changes
+ */
+public interface MseaSaFilteringNetconfService {
+ /**
+ * Returns the attribute mseaSaFiltering.
+ *
+ * @param mseaSaFiltering value of mseaSaFiltering
+ * @param session An active NETCONF session
+ * @return mseaSaFiltering
+ * @throws NetconfException if the session has any error
+ */
+ MseaSaFiltering getMseaSaFiltering(
+ MseaSaFilteringOpParam mseaSaFiltering, final NetconfSession session)
+ throws NetconfException;
+
+ /**
+ * Sets the value to attribute mseaSaFiltering.
+ *
+ * @param mseaSaFiltering value of mseaSaFiltering
+ * @param session An active NETCONF session
+ * @param targetDs The NETCONF datastore to edit
+ * @throws NetconfException if the session has any error
+ */
+ void setMseaSaFiltering(MseaSaFilteringOpParam mseaSaFiltering, NetconfSession session, TargetConfig targetDs)
+ throws NetconfException;
+
+}
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/MseaUniEvcServiceNetconfService.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/MseaUniEvcServiceNetconfService.java
new file mode 100644
index 0000000..38ccbf6
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/MseaUniEvcServiceNetconfService.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.drivers.microsemi.yang;
+
+import java.util.List;
+import java.util.Map;
+
+import org.onosproject.netconf.NetconfException;
+import org.onosproject.netconf.NetconfSession;
+import org.onosproject.netconf.TargetConfig;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.MseaUniEvcService;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.MseaUniEvcServiceOpParam;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.mseaunievcservice.mefservices.uni.UniSideInterfaceAssignmentEnum;
+
+/**
+ * Extension of mseaUniEvcServiceService to include NETCONF sessions.
+ *
+ * This is manually extended and should be revised if the msea-uni-evc-service.yang
+ * file changes
+ */
+public interface MseaUniEvcServiceNetconfService {
+ /**
+ * Returns the configuration and state attributes of the running mseaUniEvcService.
+ *
+ * @param mseaUniEvcService value of mseaUniEvcService
+ * @param session The NETCONF session
+ * @return mseaUniEvcService
+ * @throws NetconfException if the session has any error
+ */
+ MseaUniEvcService getMseaUniEvcService(
+ MseaUniEvcServiceOpParam mseaUniEvcService, NetconfSession session)
+ throws NetconfException;
+
+ /**
+ * Returns the configuration only attributes of mseaUniEvcService.
+ *
+ * @param mseaUniEvcService value of mseaUniEvcService
+ * @param session The NETCONF session
+ * @param targetDs one of running, candidate or startup
+ * @return mseaUniEvcService
+ * @throws NetconfException if the session has any error
+ */
+ MseaUniEvcService getConfigMseaUniEvcService(
+ MseaUniEvcServiceOpParam mseaUniEvcService, NetconfSession session, TargetConfig targetDs)
+ throws NetconfException;
+
+ /**
+ * Sets the value to attribute mseaUniEvcService.
+ *
+ * @param mseaUniEvcService value of mseaUniEvcService
+ * @param session The NETCONF session
+ * @param targetDs one of running, candidate or startup
+ * @throws NetconfException if the session has any error
+ */
+ void setMseaUniEvcService(MseaUniEvcServiceOpParam mseaUniEvcService,
+ NetconfSession session, TargetConfig targetDs)
+ throws NetconfException;
+
+ /**
+ * Returns a list of the CeVlanMaps on both sides of the EVC.
+ *
+ * @param session A NETCONF Session
+ * @param ncDs The datastore to affect - running, candidate or startup
+ * @return The Object Model with the VLans
+ * @throws NetconfException if the session has any error
+ */
+ MseaUniEvcService getmseaUniEvcCeVlanMaps(
+ NetconfSession session, TargetConfig ncDs)
+ throws NetconfException;
+
+ /**
+ * Replace ceVlans or delete EVCs from a device.
+ *
+ * It is necessary to have a custom command for this as the YCH cannot
+ * handle the intricacies of putting a replace operation on the
+ * ceVlanMap leaf at present
+ *
+ * @param ceVlanUpdates A Map of CeVlanMap entries to change, as flows are deleted
+ * @param flowVlanIds The IDs of flows that are being removed
+ * @param session A NETCONF Session
+ * @param targetDs The datastore to affect - running, candidate or startup
+ * @param portAssign The port assignment of the device
+ * @throws NetconfException if the session has any error
+ */
+ void removeEvcUniFlowEntries(
+ Map<Integer, String> ceVlanUpdates,
+ Map<Integer, List<Short>> flowVlanIds,
+ NetconfSession session,
+ TargetConfig targetDs,
+ UniSideInterfaceAssignmentEnum portAssign)
+ throws NetconfException;
+
+}
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/UniSide.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/UniSide.java
new file mode 100644
index 0000000..8ced81c
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/UniSide.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.drivers.microsemi.yang;
+
+/**
+ * An enumeration to describe the side of a UNI - Customer or Network.
+ * For reference see MEF 6.2
+ */
+public enum UniSide {
+ CUSTOMER,
+ NETWORK
+}
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/AbstractYangServiceImpl.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/AbstractYangServiceImpl.java
new file mode 100644
index 0000000..7b65a75
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/AbstractYangServiceImpl.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.drivers.microsemi.yang.impl;
+
+import static org.onosproject.yms.ych.YangProtocolEncodingFormat.XML;
+import static org.onosproject.yms.ydt.YmsOperationType.EDIT_CONFIG_REQUEST;
+import static org.onosproject.yms.ydt.YmsOperationType.QUERY_REPLY;
+import static org.onosproject.yms.ydt.YmsOperationType.QUERY_REQUEST;
+
+import java.util.List;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.netconf.NetconfException;
+import org.onosproject.netconf.NetconfSession;
+import org.onosproject.netconf.TargetConfig;
+import org.onosproject.yms.ych.YangCodecHandler;
+import org.onosproject.yms.ych.YangCompositeEncoding;
+import org.onosproject.yms.ymsm.YmsService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Abstract class that implements some of the core functions of a YANG model service.
+ *
+ */
+@Component(immediate = true)
+@Service
+public abstract class AbstractYangServiceImpl {
+ protected final Logger log = LoggerFactory.getLogger(getClass());
+ protected boolean alreadyLoaded = false;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected CoreService coreService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected YmsService ymsService;
+
+ protected ApplicationId appId;
+
+ // YCH is not a service and is a class variable. Can be lost on deactivate.
+ // Must be recreated on activate
+ protected YangCodecHandler ych;
+
+ @Activate
+ public abstract void activate();
+
+ @Deactivate
+ public void deactivate() {
+ alreadyLoaded = false;
+ }
+
+ /**
+ * Internal method to generically make a NETCONF get query from YANG objects.
+ * @param yangObjectOpParamFilter A YANG object model
+ * @param session A NETCONF session
+ * @return YangObjectModel
+ * @throws NetconfException if the session has any error
+ */
+ protected final Object getNetconfObject(
+ Object yangObjectOpParamFilter, NetconfSession session)
+ throws NetconfException {
+ if (session == null) {
+ throw new NetconfException("Session is null when calling getNetconfObject()");
+ }
+ if (yangObjectOpParamFilter == null) {
+ throw new NetconfException("Query object cannot be null");
+ }
+ //Convert the param to XML to use as a filter
+ YangCompositeEncoding xmlQuery =
+ ych.encodeCompositeOperation(null, null,
+ yangObjectOpParamFilter, XML, QUERY_REQUEST);
+
+ String xmlQueryStr = xmlQuery.getResourceInformation().replace("<>", "").replace("</>", "").trim();
+ log.debug("Sending <get> query on NETCONF session " + session.getSessionId() +
+ ":\n" + xmlQueryStr);
+
+ String xmlResult = session.get(xmlQueryStr, null);
+
+ List<Object> objectList = ych.decode(xmlResult, XML, QUERY_REPLY);
+ if (objectList != null && objectList.size() > 0) {
+ Object systemObject = objectList.get(0);
+ return systemObject;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Internal method to generically make a NETCONF get-config query from YANG objects.
+ *
+ * @param yangObjectOpParamFilter A YANG object model
+ * @param session A NETCONF session
+ * @param targetDs - running,candidate or startup
+ * @return YangObjectModel
+ * @throws NetconfException if the session has any error
+ */
+ protected final Object getConfigNetconfObject(
+ Object yangObjectOpParamFilter, NetconfSession session, TargetConfig targetDs)
+ throws NetconfException {
+ if (session == null) {
+ throw new NetconfException("Session is null when calling getConfigNetconfObject()");
+ }
+
+ if (yangObjectOpParamFilter == null) {
+ throw new NetconfException("Query object cannot be null");
+ }
+ //Convert the param to XML to use as a filter
+ YangCompositeEncoding xmlQuery =
+ ych.encodeCompositeOperation(null, null,
+ yangObjectOpParamFilter, XML, QUERY_REQUEST);
+
+ String xmlQueryStr = xmlQuery.getResourceInformation().replace("<>", "").replace("</>", "").trim();
+ log.debug("Sending <get-config> for " + targetDs +
+ " query on NETCONF session " + session.getSessionId() +
+ ":\n" + xmlQueryStr);
+
+ String xmlResult = session.getConfig(targetDs, xmlQueryStr);
+
+ List<Object> objectList = ych.decode(xmlResult, XML, QUERY_REPLY);
+ if (objectList != null && objectList.size() > 0) {
+ Object systemObject = objectList.get(0);
+ return systemObject;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Internal method to generically make a NETCONF edit-config call from a set of YANG objects.
+ *
+ * @param yangObjectOpParamFilter A YANG object model
+ * @param session A NETCONF session
+ * @param targetDs - running,candidate or startup
+ * @throws NetconfException if the session has any error
+ */
+ protected final void setNetconfObject(
+ Object yangObjectOpParamFilter, NetconfSession session, TargetConfig targetDs)
+ throws NetconfException {
+ if (yangObjectOpParamFilter == null) {
+ throw new NetconfException("Query object cannot be null");
+ } else if (session == null) {
+ throw new NetconfException("Session is null when calling getMseaSaFiltering()");
+ }
+ //Convert the param to XML to use as a filter
+ YangCompositeEncoding xmlContent =
+ ych.encodeCompositeOperation(null, null,
+ yangObjectOpParamFilter, XML, EDIT_CONFIG_REQUEST);
+
+ String xmlContentStr = xmlContent.getResourceInformation()
+ .replace("<>", "").replace("</>", "")
+ //FIXME: Necessary for MEP ccmInterval
+ .replaceAll("yangAutoPrefix", "")
+ .trim();
+
+ log.debug("Sending XML <edit-config> on NETCONF session " + session.getSessionId() +
+ ":\n" + xmlContentStr);
+
+ boolean succeeded = session.editConfig(targetDs, null, xmlContentStr);
+ if (succeeded) {
+ log.debug("<edit-config> succeeded through NETCONF");
+ } else {
+ throw new NetconfException("Failed to run edit-config through NETCONF");
+ }
+ }
+}
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/IetfSystemManager.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/IetfSystemManager.java
new file mode 100644
index 0000000..4c61143
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/IetfSystemManager.java
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.drivers.microsemi.yang.impl;
+
+import static org.onosproject.yms.ych.YangProtocolEncodingFormat.XML;
+import static org.onosproject.yms.ydt.YmsOperationType.QUERY_REPLY;
+
+import java.time.OffsetDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Service;
+import org.onosproject.drivers.microsemi.yang.IetfSystemNetconfService;
+import org.onosproject.netconf.NetconfException;
+import org.onosproject.netconf.NetconfSession;
+import org.onosproject.netconf.TargetConfig;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.system.rev20160505.IetfSystemMicrosemiService;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.system.rev20160505.ietfsystemmicrosemi.doupgradeandreboot.DoUpgradeAndRebootInput;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.system.rev20160505.ietfsystemmicrosemi.doupgradeandreboot.DoUpgradeAndRebootOutput;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.system.rev20160505.ietfsystemmicrosemi.pullupdatetarfromtftp.PullUpdateTarFromTftpInput;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.system.rev20160505.ietfsystemmicrosemi.readfromsyslog.ReadFromSyslogInput;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.system.rev20160505.ietfsystemmicrosemi.readfromsyslog.ReadFromSyslogOutput;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.system.rev20140806.IetfSystem;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.system.rev20140806.IetfSystemOpParam;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.system.rev20140806.IetfSystemService;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.system.rev20140806.ietfsystem.systemrestart.SystemRestartInput;
+
+/**
+ * Implementation of the IetfService YANG model service.
+ */
+@Component(immediate = true, inherit = true)
+@Service
+public class IetfSystemManager extends AbstractYangServiceImpl
+ implements IetfSystemNetconfService {
+
+ protected final Pattern regexRemoveSystem =
+ Pattern.compile("(<system).*(</system>)", Pattern.DOTALL);
+ protected final Pattern regexRemoveSystemState =
+ Pattern.compile("(<system-state).*(</system-state>)", Pattern.DOTALL);
+
+ protected static final String IETF_SYSTEM = "org.onosproject.drivers.microsemi.yang.ietfsystem";
+
+ @Activate
+ public void activate() {
+ appId = coreService.registerApplication(IETF_SYSTEM);
+ ych = ymsService.getYangCodecHandler();
+ ych.addDeviceSchema(IetfSystemService.class);
+ ych.addDeviceSchema(IetfSystemMicrosemiService.class);
+ log.info("IetfSystemManager Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+ super.deactivate();
+ ymsService.unRegisterService(this, IetfSystemService.class);
+ ymsService.unRegisterService(this, IetfSystemMicrosemiService.class);
+ ych = null;
+ log.info("IetfSystemManager Stopped");
+ }
+
+ /**
+ * Get a filtered subset of the model.
+ * This is meant to filter the current live model
+ * against the attribute(s) given in the argument
+ * and return the filtered model.
+ * @throws NetconfException if the session has any error
+ */
+ @Override
+ public IetfSystem getIetfSystem(IetfSystemOpParam ietfSystemFilter, NetconfSession session)
+ throws NetconfException {
+ return (IetfSystem) getNetconfObject(ietfSystemFilter, session);
+ }
+
+ @Override
+ public IetfSystem getIetfSystemInit(NetconfSession session) throws NetconfException {
+ if (session == null) {
+ throw new NetconfException("Session is null when calling getIetfSystemInit()");
+ }
+
+ String xmlResult = session.get(getInitRequestBuilder(), null);
+
+ //The result will be a <system> followed by <system-state>
+ //YCH can decode only one at a time - split it and send half each time
+ IetfSystem.IetfSystemBuilder iBuilder = new IetfSystemOpParam.IetfSystemBuilder();
+
+ String xmlResultSystem = regexRemoveSystemState.matcher(xmlResult).replaceFirst("");
+ List<Object> objectListState = ych.decode(xmlResultSystem, XML, QUERY_REPLY);
+ if (objectListState != null && objectListState.size() > 0) {
+ IetfSystem system = (IetfSystem) objectListState.get(0);
+ iBuilder.system(system.system());
+ }
+
+ String xmlResultSystemState = regexRemoveSystem.matcher(xmlResult).replaceFirst("");
+ List<Object> objectListSystemState = ych.decode(xmlResultSystemState, XML, QUERY_REPLY);
+ if (objectListSystemState != null && objectListSystemState.size() > 0) {
+ IetfSystem system = (IetfSystem) objectListSystemState.get(0);
+ iBuilder.systemState(system.systemState());
+ }
+
+ return iBuilder.build();
+ }
+
+ /**
+ * Call NETCONF edit-config with a configuration.
+ */
+ @Override
+ public void setIetfSystem(IetfSystemOpParam ietfSystem, NetconfSession session, TargetConfig ncDs)
+ throws NetconfException {
+ setNetconfObject(ietfSystem, session, ncDs);
+ }
+
+ @Override
+ public void setCurrentDatetime(OffsetDateTime date, NetconfSession session)
+ throws NetconfException {
+ String xmlQueryStr = getSetCurrentDatetimeBuilder(date);
+ log.info("Sending <get> query on NETCONF session " + session.getSessionId() +
+ ":\n" + xmlQueryStr);
+
+ String xmlResult = session.doWrappedRpc(xmlQueryStr);
+ log.info("Result from NETCONF RPC <set-current-datetime>: {}", xmlResult);
+ }
+
+ @Override
+ public void systemRestart(SystemRestartInput inputVar, NetconfSession session) {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ @Override
+ public void systemShutdown(NetconfSession session) {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ @Override
+ public DoUpgradeAndRebootOutput doUpgradeAndReboot(DoUpgradeAndRebootInput inputVar, NetconfSession session)
+ throws NetconfException {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ @Override
+ public void pullUpdateTarFromTftp(PullUpdateTarFromTftpInput inputVar, NetconfSession session)
+ throws NetconfException {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ @Override
+ public ReadFromSyslogOutput readFromSyslog(ReadFromSyslogInput inputVar, NetconfSession session)
+ throws NetconfException {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+
+ /**
+ * Builds a request crafted to get the configuration required to create
+ * details descriptions for the device.
+ *
+ * @return The request string.
+ */
+ private static String getInitRequestBuilder() {
+ StringBuilder rpc = new StringBuilder();
+ rpc.append("<system-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-system\" ");
+ rpc.append("xmlns:sysms=\"http://www.microsemi.com/microsemi-edge-assure/msea-system\">");
+ rpc.append("<platform>");
+ rpc.append("<os-release/>");
+ rpc.append("<sysms:device-identification>");
+ rpc.append("<sysms:serial-number/>");
+ rpc.append("</sysms:device-identification>");
+ rpc.append("</platform>");
+ rpc.append("<clock>");
+ rpc.append("<current-datetime/>");
+ rpc.append("</clock>");
+ rpc.append("</system-state>");
+ rpc.append("<system xmlns=\"urn:ietf:params:xml:ns:yang:ietf-system\" ");
+ rpc.append("xmlns:sysms=\"http://www.microsemi.com/microsemi-edge-assure/msea-system\">");
+ rpc.append("<sysms:longitude/>");
+ rpc.append("<sysms:latitude/>");
+ rpc.append("</system>");
+ return rpc.toString();
+ }
+
+ private static String getSetCurrentDatetimeBuilder(OffsetDateTime date) {
+ StringBuilder rpc = new StringBuilder();
+ rpc.append("<set-current-datetime xmlns=\"urn:ietf:params:xml:ns:yang:ietf-system\">");
+ rpc.append("<current-datetime>");
+ rpc.append(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx")));
+ rpc.append("</current-datetime>");
+ rpc.append("</set-current-datetime>");
+
+ return rpc.toString();
+ }
+}
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/MseaCfmManager.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/MseaCfmManager.java
new file mode 100644
index 0000000..c2359ab
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/MseaCfmManager.java
@@ -0,0 +1,221 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.drivers.microsemi.yang.impl;
+
+import static org.onosproject.yms.ych.YangProtocolEncodingFormat.XML;
+import static org.onosproject.yms.ydt.YmsOperationType.QUERY_REPLY;
+
+import java.util.List;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Service;
+import org.onosproject.drivers.microsemi.yang.MseaCfmNetconfService;
+import org.onosproject.netconf.NetconfException;
+import org.onosproject.netconf.NetconfSession;
+import org.onosproject.netconf.TargetConfig;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.MseaCfm;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.MseaCfmOpParam;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.MseaCfmService;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.mseacfm.MseaCfmEventListener;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.mseacfm.abortloopback.AbortLoopbackInput;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.mseacfm.transmitlinktrace.TransmitLinktraceInput;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.mseacfm.transmitlinktrace.TransmitLinktraceOutput;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.cfm.rev20160229.mseacfm.transmitloopback.TransmitLoopbackInput;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.soam.fm.rev20160229.MseaSoamFmService;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.soam.pm.rev20160229.MseaSoamPmService;
+
+/**
+ * Implementation of the MseaCfmServiceNetconf YANG model service.
+ */
+@Component(immediate = true, inherit = true)
+@Service
+public class MseaCfmManager extends AbstractYangServiceImpl
+ implements MseaCfmNetconfService {
+
+ public static final String MSEA_CFM = "org.onosproject.drivers.microsemi.yang.mseacfmservice";
+
+ @Activate
+ public void activate() {
+ appId = coreService.registerApplication(MSEA_CFM);
+ ych = ymsService.getYangCodecHandler();
+ ych.addDeviceSchema(MseaCfmService.class);
+ ych.addDeviceSchema(MseaSoamFmService.class);
+ ych.addDeviceSchema(MseaSoamPmService.class);
+ log.info("MseaCfmService Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+ super.deactivate();
+ ymsService.unRegisterService(this, MseaCfmService.class);
+ ymsService.unRegisterService(this, MseaSoamFmService.class);
+ ymsService.unRegisterService(this, MseaSoamPmService.class);
+ ych = null;
+ log.info("MseaCfmService Stopped");
+ }
+
+ @Override
+ public MseaCfm getMepEssentials(String mdName, String maName, int mepId,
+ NetconfSession session) throws NetconfException {
+ if (session == null) {
+ throw new NetconfException("Session is null when calling getMepEssentials()");
+ }
+
+ String xmlQueryStr = buildMepQueryString(mdName, maName, mepId);
+ log.debug("Sending <get> for " +
+ " query on NETCONF session " + session.getSessionId() +
+ ":\n" + xmlQueryStr);
+
+ String xmlResult = session.get(xmlQueryStr, null);
+ //FIXME Line is removed because YCH decode does not know how to handle it
+ xmlResult = xmlResult.replaceAll("(<ccm-interval>)(3.3ms|10ms|100ms|1s)(</ccm-interval>)", "");
+ xmlResult = xmlResult.replaceAll("(<active-defects/>)", "");
+
+ List<Object> objectList = ych.decode(xmlResult, XML, QUERY_REPLY);
+ if (objectList != null && objectList.size() > 0) {
+ Object systemObject = objectList.get(0);
+ return (MseaCfm) systemObject;
+ } else {
+ throw new NetconfException("Failure of YCH decode - could not parse as MseaCfm: " + xmlResult);
+ }
+ }
+
+ @Override
+ public MseaCfm getSoamDm(String mdName, String maName, int mepId,
+ int dmId, NetconfSession session) throws NetconfException {
+ String xmlQueryStr = buildDmQueryString(mdName, maName, mepId, dmId);
+ log.debug("Sending <get> for " +
+ " query on NETCONF session " + session.getSessionId() +
+ ":\n" + xmlQueryStr);
+
+ String xmlResult = session.get(xmlQueryStr, null);
+
+ List<Object> objectList = ych.decode(xmlResult, XML, QUERY_REPLY);
+ if (objectList != null && objectList.size() > 0) {
+ Object systemObject = objectList.get(0);
+ return (MseaCfm) systemObject;
+ } else {
+ throw new NetconfException("Failure of YCH decode - could not parse as MseaCfm: " + xmlResult);
+ }
+ }
+
+ @Override
+ public void setMseaCfm(MseaCfmOpParam mseaCfm, NetconfSession session, TargetConfig targetDs)
+ throws NetconfException {
+ setNetconfObject(mseaCfm, session, targetDs);
+ }
+
+ /**
+ * Call RPCs on the device through NETCONF.
+ */
+ @Override
+ public void transmitLoopback(TransmitLoopbackInput inputVar, NetconfSession session) throws NetconfException {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ @Override
+ public void abortLoopback(AbortLoopbackInput inputVar, NetconfSession session) throws NetconfException {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ @Override
+ public TransmitLinktraceOutput transmitLinktrace(TransmitLinktraceInput inputVar, NetconfSession session)
+ throws NetconfException {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ @Override
+ public void addListener(MseaCfmEventListener listener) {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ @Override
+ public void removeListener(MseaCfmEventListener listener) {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ private String buildMepQueryString(String mdName, String maName, int mepId) {
+ StringBuilder rpc = new StringBuilder();
+
+ rpc.append("<mef-cfm xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-cfm\" ");
+ rpc.append(" xmlns:msea-soam-fm=\"http://www.microsemi.com/microsemi-edge-assure/msea-soam-fm\" ");
+ rpc.append("xmlns:msea-soam-pm=\"http://www.microsemi.com/microsemi-edge-assure/msea-soam-pm\">\n");
+ rpc.append("<maintenance-domain>\n");
+ rpc.append("<id/>\n");
+ rpc.append("<name>" + mdName + "</name>\n");
+ rpc.append("<md-level/>\n");
+ rpc.append("<maintenance-association>\n");
+ rpc.append("<id/>\n");
+ rpc.append("<name>" + maName + "</name>\n");
+// rpc.append("<ccm-interval>10ms</ccm-interval>\n"); //Have to omit for the moment - YMS problem
+ rpc.append("<remote-meps/>\n");
+ rpc.append("<component-list/>\n");
+ rpc.append("<maintenance-association-end-point>\n");
+ rpc.append("<mep-identifier>" + mepId + "</mep-identifier>\n");
+ rpc.append("<interface/>\n");
+ rpc.append("<primary-vid/>\n");
+ rpc.append("<administrative-state/>\n");
+ rpc.append("<ccm-ltm-priority/>\n");
+ rpc.append("<continuity-check/>\n");
+ rpc.append("<mac-address/>\n");
+ rpc.append("<msea-soam-fm:port-status/>\n");
+ rpc.append("<msea-soam-fm:interface-status/>\n");
+// rpc.append("<msea-soam-fm:last-defect-sent/>\n");//Have to omit for the moment - YMS problem
+ rpc.append("<msea-soam-fm:rdi-transmit-status/>\n");
+ rpc.append("<loopback/>\n");
+ rpc.append("<remote-mep-database/>\n");
+ rpc.append("<linktrace/>\n");
+ rpc.append("</maintenance-association-end-point>\n");
+ rpc.append("</maintenance-association>\n");
+ rpc.append("</maintenance-domain>\n");
+ rpc.append("</mef-cfm>");
+
+ return rpc.toString();
+ }
+
+
+ private String buildDmQueryString(String mdName, String maName, int mepId, int dmId) {
+ StringBuilder rpc = new StringBuilder();
+
+ rpc.append("<mef-cfm xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-cfm\" ");
+ rpc.append(" xmlns:msea-soam-fm=\"http://www.microsemi.com/microsemi-edge-assure/msea-soam-fm\" ");
+ rpc.append("xmlns:msea-soam-pm=\"http://www.microsemi.com/microsemi-edge-assure/msea-soam-pm\">\n");
+ rpc.append("<maintenance-domain>\n");
+ rpc.append("<id/>\n");
+ rpc.append("<name>" + mdName + "</name>\n");
+ rpc.append("<md-level/>\n");
+ rpc.append("<maintenance-association>\n");
+ rpc.append("<id/>\n");
+ rpc.append("<name>" + maName + "</name>\n");
+// rpc.append("<ccm-interval>10ms</ccm-interval>\n"); //Have to omit for the moment - YMS problem
+ rpc.append("<maintenance-association-end-point>\n");
+ rpc.append("<mep-identifier>" + mepId + "</mep-identifier>\n");
+ rpc.append("<msea-soam-pm:delay-measurements>");
+ rpc.append("<msea-soam-pm:delay-measurement>");
+ rpc.append("<msea-soam-pm:dm-id>" + dmId + "</msea-soam-pm:dm-id>");
+ rpc.append("</msea-soam-pm:delay-measurement>");
+ rpc.append("</msea-soam-pm:delay-measurements>");
+ rpc.append("</maintenance-association-end-point>\n");
+ rpc.append("</maintenance-association>\n");
+ rpc.append("</maintenance-domain>\n");
+ rpc.append("</mef-cfm>");
+
+ return rpc.toString();
+ }
+
+}
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/MseaSaFilteringManager.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/MseaSaFilteringManager.java
new file mode 100644
index 0000000..eeba11e
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/MseaSaFilteringManager.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.drivers.microsemi.yang.impl;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Service;
+import org.onosproject.drivers.microsemi.yang.MseaSaFilteringNetconfService;
+import org.onosproject.netconf.NetconfException;
+import org.onosproject.netconf.NetconfSession;
+import org.onosproject.netconf.TargetConfig;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.sa.filtering.rev20160412.MseaSaFiltering;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.sa.filtering.rev20160412.MseaSaFilteringOpParam;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.sa.filtering.rev20160412.MseaSaFilteringService;
+
+/**
+ * Implementation of the MseaSaFiltering YANG model service.
+ */
+@Component(immediate = true, inherit = true)
+@Service
+public class MseaSaFilteringManager extends AbstractYangServiceImpl
+ implements MseaSaFilteringNetconfService {
+ public static final String MSEA_SA_FILTERING = "org.onosproject.drivers.microsemi.yang.mseasafiltering";
+
+ @Activate
+ public void activate() {
+ appId = coreService.registerApplication(MSEA_SA_FILTERING);
+ ych = ymsService.getYangCodecHandler();
+ ych.addDeviceSchema(MseaSaFilteringService.class);
+ log.info("MseaSaFilteringManager Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+ super.deactivate();
+ ymsService.unRegisterService(this, MseaSaFilteringService.class);
+ ych = null;
+ log.info("MseaSaFilteringManager Stopped");
+ }
+
+ /**
+ * Get a filtered subset of the model.
+ * This is meant to filter the current live model
+ * against the attribute(s) given in the argument
+ * and return the filtered model.
+ */
+ @Override
+ public MseaSaFiltering getMseaSaFiltering(MseaSaFilteringOpParam mseaSaFilteringFilter, NetconfSession session)
+ throws NetconfException {
+ return (MseaSaFiltering) getNetconfObject(mseaSaFilteringFilter, session);
+ }
+
+ /**
+ * Call NETCONF edit-config with a configuration.
+ */
+ @Override
+ public void setMseaSaFiltering(
+ MseaSaFilteringOpParam mseaSaFiltering, NetconfSession session, TargetConfig ncDs)
+ throws NetconfException {
+ setNetconfObject(mseaSaFiltering, session, ncDs);
+ }
+}
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/MseaUniEvcServiceManager.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/MseaUniEvcServiceManager.java
new file mode 100644
index 0000000..82b6116
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/MseaUniEvcServiceManager.java
@@ -0,0 +1,226 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.drivers.microsemi.yang.impl;
+
+import static org.onosproject.yms.ych.YangProtocolEncodingFormat.XML;
+import static org.onosproject.yms.ydt.YmsOperationType.QUERY_CONFIG_REPLY;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Service;
+import org.onosproject.drivers.microsemi.yang.MseaUniEvcServiceNetconfService;
+import org.onosproject.netconf.NetconfException;
+import org.onosproject.netconf.NetconfSession;
+import org.onosproject.netconf.TargetConfig;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.MseaUniEvcService;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.MseaUniEvcServiceOpParam;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.MseaUniEvcServiceService;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.mseaunievcservice.mefservices.uni.UniSideInterfaceAssignmentEnum;
+
+/**
+ * Implementation of the MseaUniEvcServiceService YANG model service.
+ */
+@Component(immediate = true, inherit = true)
+@Service
+public class MseaUniEvcServiceManager extends AbstractYangServiceImpl
+ implements MseaUniEvcServiceNetconfService {
+ public static final String MSEA_SA_FILTERING = "org.onosproject.drivers.microsemi.yang.mseaunievcservice";
+
+ @Activate
+ public void activate() {
+ appId = coreService.registerApplication(MSEA_SA_FILTERING);
+ ych = ymsService.getYangCodecHandler();
+ ych.addDeviceSchema(MseaUniEvcServiceService.class);
+ log.info("MseaUniEvcServiceManager Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+ super.deactivate();
+ ymsService.unRegisterService(this, MseaUniEvcServiceService.class);
+ ych = null;
+ log.info("MseaUniEvcServiceManager Stopped");
+ }
+
+ @Override
+ public MseaUniEvcService getMseaUniEvcService(
+ MseaUniEvcServiceOpParam mseaUniEvcService, NetconfSession session) throws NetconfException {
+ return (MseaUniEvcService) getNetconfObject(mseaUniEvcService, session);
+ }
+
+ @Override
+ public MseaUniEvcService getConfigMseaUniEvcService(
+ MseaUniEvcServiceOpParam mseaUniEvcService, NetconfSession session, TargetConfig targetDs)
+ throws NetconfException {
+ return (MseaUniEvcService) getConfigNetconfObject(mseaUniEvcService, session, targetDs);
+ }
+
+ /**
+ * Modify the configuration.
+ */
+ @Override
+ public void setMseaUniEvcService(
+ MseaUniEvcServiceOpParam mseaUniEvcService, NetconfSession session, TargetConfig ncDs)
+ throws NetconfException {
+ setNetconfObject(mseaUniEvcService, session, ncDs);
+ }
+
+ @Override
+ public MseaUniEvcService getmseaUniEvcCeVlanMaps(
+ NetconfSession session, TargetConfig ncDs)
+ throws NetconfException {
+ if (session == null) {
+ throw new NetconfException("Session is null when calling getMseaSaFiltering()");
+ }
+
+ String xmlResult = session.getConfig(ncDs, evcFilterQuery());
+
+ List<Object> objectList = ych.decode(xmlResult, XML, QUERY_CONFIG_REPLY);
+ if (objectList != null && objectList.size() > 0) {
+ return (MseaUniEvcService) objectList.get(0);
+ }
+
+ return null;
+ }
+
+ @Override
+ public void removeEvcUniFlowEntries(
+ Map<Integer, String> ceVlanUpdates,
+ Map<Integer, List<Short>> flowVlanIds,
+ NetconfSession session, TargetConfig targetDs,
+ UniSideInterfaceAssignmentEnum portAssign) throws NetconfException {
+
+ List<Integer> evcAlreadyHandled = new ArrayList<>();
+ StringBuilder xmlEvcUpdate = new StringBuilder(evcUniOpener());
+ for (Integer evcKey:ceVlanUpdates.keySet()) {
+ int evcId = (evcKey & ((1 << 8) - 100)) >> 2;
+ if (evcAlreadyHandled.contains(new Integer(evcId))) {
+ continue;
+ }
+ evcAlreadyHandled.add(evcId);
+ int port = (evcKey & 3);
+ String ceVlanMapThis = ceVlanUpdates.get(evcKey);
+ String ceVlanMapOpposite = ceVlanUpdates.get(evcKey ^ 1);
+
+ if ((ceVlanMapThis == null || ceVlanMapThis.isEmpty()) &&
+ (ceVlanMapOpposite == null || ceVlanMapOpposite.isEmpty())) {
+ xmlEvcUpdate.append("<evc nc:operation=\"delete\">\n<evc-index>");
+ xmlEvcUpdate.append(Integer.toString(evcId));
+ xmlEvcUpdate.append("</evc-index>\n</evc>\n");
+ } else {
+ xmlEvcUpdate.append("<evc>\n<evc-index>");
+ xmlEvcUpdate.append(Integer.toString(evcId));
+ xmlEvcUpdate.append("</evc-index>\n<evc-per-uni>\n");
+ if (port == 0 && portAssign == UniSideInterfaceAssignmentEnum.UNI_C_ON_OPTICS ||
+ port == 1 && portAssign == UniSideInterfaceAssignmentEnum.UNI_C_ON_HOST) {
+ if (ceVlanMapThis != null) {
+ xmlEvcUpdate.append("<evc-per-uni-c>\n<ce-vlan-map nc:operation=\"replace\">");
+ xmlEvcUpdate.append(ceVlanMapThis);
+ xmlEvcUpdate.append("</ce-vlan-map>\n");
+ xmlEvcUpdate.append(deleteFlowMapping(flowVlanIds.get(evcKey)));
+ xmlEvcUpdate.append("</evc-per-uni-c>\n");
+ }
+ if (ceVlanMapOpposite != null) {
+ xmlEvcUpdate.append("<evc-per-uni-n>\n<ce-vlan-map nc:operation=\"replace\">");
+ xmlEvcUpdate.append(ceVlanMapOpposite);
+ xmlEvcUpdate.append("</ce-vlan-map>\n");
+ xmlEvcUpdate.append(deleteFlowMapping(flowVlanIds.get(evcKey ^ 1)));
+ xmlEvcUpdate.append("</evc-per-uni-n>\n");
+ }
+ } else {
+ if (ceVlanMapThis != null) {
+ xmlEvcUpdate.append("<evc-per-uni-n>\n<ce-vlan-map nc:operation=\"replace\">");
+ xmlEvcUpdate.append(ceVlanMapThis);
+ xmlEvcUpdate.append("</ce-vlan-map>\n");
+ xmlEvcUpdate.append(deleteFlowMapping(flowVlanIds.get(evcKey)));
+ xmlEvcUpdate.append("</evc-per-uni-n>\n");
+ }
+ if (ceVlanMapOpposite != null) {
+ xmlEvcUpdate.append("<evc-per-uni-c>\n<ce-vlan-map nc:operation=\"replace\">");
+ xmlEvcUpdate.append(ceVlanMapOpposite);
+ xmlEvcUpdate.append("</ce-vlan-map>\n");
+ xmlEvcUpdate.append(deleteFlowMapping(flowVlanIds.get(evcKey ^ 1)));
+ xmlEvcUpdate.append("</evc-per-uni-c>\n");
+ }
+ }
+
+ xmlEvcUpdate.append("</evc-per-uni>\n</evc>\n");
+ }
+ }
+ xmlEvcUpdate.append("</uni>\n</mef-services>");
+
+ log.info("Sending XML <edit-config> on NETCONF session " + session.getSessionId() +
+ ":\n" + xmlEvcUpdate.toString());
+
+
+ session.editConfig(targetDs, null, xmlEvcUpdate.toString());
+ }
+
+
+ private static String deleteFlowMapping(List<Short> vlanIds) {
+ if (vlanIds == null || vlanIds.size() == 0) {
+ return "";
+ }
+ StringBuilder fmXmlBuilder = new StringBuilder();
+ for (long vlanId:vlanIds) {
+ fmXmlBuilder.append("<flow-mapping nc:operation=\"delete\">\n");
+ fmXmlBuilder.append("<ce-vlan-id>");
+ fmXmlBuilder.append(String.valueOf(vlanId));
+ fmXmlBuilder.append("</ce-vlan-id>\n");
+ fmXmlBuilder.append("</flow-mapping>\n");
+ }
+
+ return fmXmlBuilder.toString();
+ }
+
+ private String evcFilterQuery() {
+ StringBuilder sb = new StringBuilder("<mef-services "
+ + "xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-uni-evc-service\">");
+ sb.append("<uni>");
+ sb.append("<evc>");
+ sb.append("<evc-index/>");
+ sb.append("<evc-per-uni>");
+ sb.append("<evc-per-uni-c>");
+ sb.append("<ce-vlan-map/>");
+ sb.append("<flow-mapping/>");
+ sb.append("<ingress-bwp-group-index/>");
+ sb.append("</evc-per-uni-c>");
+ sb.append("<evc-per-uni-n>");
+ sb.append("<ce-vlan-map/>");
+ sb.append("<flow-mapping/>");
+ sb.append("<ingress-bwp-group-index/>");
+ sb.append("</evc-per-uni-n>");
+ sb.append("</evc-per-uni>");
+ sb.append("</evc>");
+ sb.append("</uni>");
+ sb.append("</mef-services>");
+
+ return sb.toString();
+ }
+
+ private String evcUniOpener() {
+ StringBuilder sb = new StringBuilder("<mef-services ");
+ sb.append("xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-uni-evc-service\">\n");
+ sb.append("<uni>\n");
+
+ return sb.toString();
+ }
+}
\ No newline at end of file
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/package-info.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/package-info.java
new file mode 100644
index 0000000..ccf0dd2
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Package for Microsemi device drivers support for NETCONF for EA1000.
+ */
+package org.onosproject.drivers.microsemi.yang.impl;
\ No newline at end of file
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/package-info.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/package-info.java
new file mode 100644
index 0000000..d886c69
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Package for Microsemi device drivers support for NETCONF for EA1000.
+ */
+package org.onosproject.drivers.microsemi.yang;
\ No newline at end of file
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/utils/CeVlanMapUtils.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/utils/CeVlanMapUtils.java
new file mode 100644
index 0000000..52ede6d
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/utils/CeVlanMapUtils.java
@@ -0,0 +1,196 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.drivers.microsemi.yang.utils;
+
+import java.util.Arrays;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.commons.lang.ArrayUtils;
+
+/**
+ * A set of static utilities that allow a ce-vlan-map to be decomposed.
+ *
+ * This is an implementation specific to Microsemi that encodes ce-vlan-map
+ * in a similar way to Section 7.9 in the MEF 10.2 specification. That specification
+ * suggests comma delimited lists of VIDs - this implementation adds on colons to
+ * specify a contiguous range of IDs
+ */
+public final class CeVlanMapUtils {
+
+ private CeVlanMapUtils() {
+ //Do not allow this utility class to be instantiated
+ }
+
+ /**
+ * Calculate the ceVlanMap in to a Set of values.
+ *
+ * From Yang description
+ * "This object indicates the CE-VLANs associated with the specific
+ * EVC on a UNI. CE-VLAN IDs have value of 0 to 4095. The CE-VLAN ID
+ * list can be a single value or multiple values separated by a delimiter.
+ * Some valid values are: '100', '1:10', '10,20,30', '1:4095'. In the
+ * first example only CE-VLAN ID 100 is associated with the VLAN map.
+ * In the second example the CE-VLAN map includes CE-VLAN IDs 1 through
+ * 10 (range of values). The third example indicates three separate values
+ * that make up the CE-VLAN map. The last example indicates all CE-VLAN IDs
+ * are included in the map (range of values). ";
+ * reference
+ * "[MEF 6.1] 6.1; [MEF 7.2] 6.2.1.3";
+ * @param ceVlanMap A list of vlan id's in the format described above
+ * @return A set of vlan ids
+ */
+ public static Short[] getVlanSet(String ceVlanMap) {
+ if (ceVlanMap == null || ceVlanMap.isEmpty()) {
+ return new Short[0];
+ }
+ Set<Short> ceVlanSet = new TreeSet<Short>();
+
+ String[] ceVlanMapCommas = ceVlanMap.split(",");
+ for (String ceVlanMapComma:ceVlanMapCommas) {
+ String[] ceVlanMapColon = ceVlanMapComma.split(":");
+ if (ceVlanMapColon.length == 1) {
+ ceVlanSet.add(Short.decode(ceVlanMapColon[0]));
+ } else {
+ short start = Short.decode(ceVlanMapColon[0]);
+ short end = Short.decode(ceVlanMapColon[1]);
+ if ((start < 0 || end > 4095)) {
+ return null;
+ } else {
+ for (short i = start; i <= end; i++) {
+ ceVlanSet.add(i);
+ }
+ }
+ }
+ }
+
+ return ceVlanSet.toArray(new Short[ceVlanSet.size()]);
+ }
+
+ /**
+ * Convert an array of vlan ids in to a string representation.
+ * @param vlanArray An array of vlan ids
+ * @return A string representation delimited by commas and colons
+ */
+ public static String vlanListAsString(Short[] vlanArray) {
+ boolean colonPending = false;
+ StringBuilder ceVlanMapBuilder = new StringBuilder();
+ if (vlanArray.length == 0) {
+ return "";
+ } else if (vlanArray.length == 1 && vlanArray[0] == 0) {
+ return "0";
+ }
+
+ //To ensure that there are no repeated or out-of-order elements we must convert to TreeSet
+ TreeSet<Short> vlanSet = new TreeSet<>(Arrays.asList(vlanArray));
+
+ if (vlanSet.first() == 0) {
+ vlanSet.remove(vlanSet.first());
+ }
+ short prev = vlanSet.first();
+ for (short s:vlanSet) {
+ if (s == prev) {
+ ceVlanMapBuilder.append(Short.valueOf(s));
+ continue;
+ } else if (prev == (s - 1)) {
+ colonPending = true;
+ } else {
+ if (colonPending) {
+ ceVlanMapBuilder.append(":" + Short.valueOf(prev));
+ colonPending = false;
+ }
+ ceVlanMapBuilder.append("," + Short.valueOf(s));
+ }
+ prev = s;
+ }
+ if (colonPending) {
+ ceVlanMapBuilder.append(":" + Short.valueOf(prev));
+ }
+
+ return ceVlanMapBuilder.toString();
+ }
+
+ /**
+ * Add an additional vlan id to an existing string representation.
+ * @param existingMap An array of vlan ids
+ * @param newVlan The new vlan ID to add
+ * @return A string representation delimited by commas and colons
+ */
+ public static String addtoCeVlanMap(String existingMap, Short newVlan) {
+ Short[] vlanArray = getVlanSet(existingMap);
+ TreeSet<Short> vlanSet = new TreeSet<>();
+ for (Short vlan:vlanArray) {
+ vlanSet.add(vlan);
+ }
+
+ vlanSet.add(newVlan);
+
+ return vlanListAsString(vlanSet.toArray(new Short[vlanSet.size()]));
+ }
+
+ /**
+ * If a string representation contains a '0' then remove it.
+ *
+ * Zero is an invalid VLAN id, and is used here as a place holder for null. Null can't
+ * be used in the EA1000 device. Once any other vlan ids are added then the zero should
+ * be removed. It is safe to call this method even if no zero is present - the method will
+ * make no change in that case.
+ *
+ * @param existingMap An string representation of vlan ids, possibly containing a zero
+ * @return A string representation delimited by commas and colons without zero
+ */
+ public static String removeZeroIfPossible(String existingMap) {
+ if (existingMap == null || existingMap.isEmpty()) {
+ return "0";
+ } else if (existingMap == "0") {
+ return existingMap;
+ }
+ return removeFromCeVlanMap(existingMap, (short) 0);
+ }
+
+ /**
+ * Remove a vlan id from an existing string representation.
+ * @param existingMap An array of vlan ids
+ * @param vlanRemove The vlan ID to remove
+ * @return A string representation delimited by commas and colons
+ */
+ public static String removeFromCeVlanMap(String existingMap, Short vlanRemove) {
+ Short[] vlanArray = getVlanSet(existingMap);
+ TreeSet<Short> vlanSet = new TreeSet<>();
+ for (Short vlan:vlanArray) {
+ if (vlan.shortValue() != vlanRemove.shortValue()) {
+ vlanSet.add(vlan);
+ }
+ }
+
+ return vlanListAsString(vlanSet.toArray(new Short[vlanSet.size()]));
+ }
+
+ /**
+ * Combine vlan ids from two existing string representations.
+ *
+ * If there are overlapping elements and ranges, these are consolidated in to one.
+ *
+ * @param set1 A string containing a set of vlan ids
+ * @param set2 A string containing a set of vlan ids
+ * @return A string representation delimited by commas and colons
+ */
+ public static String combineVlanSets(String set1, String set2) {
+ Short[] set1Array = getVlanSet(set1);
+ Short[] set2Array = getVlanSet(set2);
+ return vlanListAsString((Short[]) ArrayUtils.addAll(set1Array, set2Array));
+ }
+}
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/utils/IetfYangTypesUtils.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/utils/IetfYangTypesUtils.java
new file mode 100644
index 0000000..4b706b6
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/utils/IetfYangTypesUtils.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.drivers.microsemi.yang.utils;
+
+import java.time.LocalDateTime;
+import java.time.OffsetDateTime;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev20130715.ietfyangtypes.DateAndTime;
+
+/**
+ * A utility class to change various YANG types to general purpose classes.
+ */
+public final class IetfYangTypesUtils {
+ private IetfYangTypesUtils() {
+ //Hiding the public constructor for this utility class
+ }
+
+ /**
+ * Convert from Date and Time in a ietf-yang-types format to the Java Time API.
+ * @param dateAndTime A date and time from a YANG object
+ * @return A Date and Time with a Time Zone offset
+ */
+ public static OffsetDateTime fromYangDateTime(DateAndTime dateAndTime) {
+ return OffsetDateTime.parse(dateAndTime.toString(), DateTimeFormatter.ISO_OFFSET_DATE_TIME);
+ }
+
+ /**
+ * Convert a from Date and Time in a ietf-yang-types format to the Java Time API and rezone to a given Time Zone.
+ * @param dateAndTime A date and time from a YANG object
+ * @param zoneId The time zone to rezone the time and date to
+ * @return The rezoned time and date
+ */
+ public static ZonedDateTime fromYangDateTimeZoned(DateAndTime dateAndTime, ZoneId zoneId) {
+ return OffsetDateTime.parse(dateAndTime.toString(),
+ DateTimeFormatter.ISO_OFFSET_DATE_TIME).atZoneSameInstant(zoneId);
+ }
+
+ /**
+ * Convert a from Date and Time in a ietf-yang-types format to the Java Time API rezoned to the local Time Zone.
+ * @param dateAndTime A date and time from a YANG object
+ * @return The date and time in the zone of this local machine
+ */
+ public static LocalDateTime fromYangDateTimeToLocal(DateAndTime dateAndTime) {
+ OffsetDateTime odt = OffsetDateTime.parse(dateAndTime.toString(), DateTimeFormatter.ISO_OFFSET_DATE_TIME);
+
+ return LocalDateTime.ofInstant(odt.toInstant(), ZoneId.systemDefault());
+ }
+}
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/utils/package-info.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/utils/package-info.java
new file mode 100644
index 0000000..0c03c46
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/drivers/microsemi/yang/utils/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Package for general utilities and helpers.
+ */
+package org.onosproject.drivers.microsemi.yang.utils;
\ No newline at end of file
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/CustomEvc.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/CustomEvc.java
new file mode 100644
index 0000000..722fe78
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/CustomEvc.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service
+ .rev20160317.mseaunievcservice.mefservices.uni;
+
+import org.onosproject.drivers.microsemi.yang.UniSide;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.types
+ .rev20160229.mseatypes.ServiceListType;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.mseaunievcservice.evcperuniextensionattributes.FlowMapping;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service
+ .rev20160317.mseaunievcservice.mefservices.uni.evc.CustomEvcPerUni;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.mseaunievcservice.mefservices.uni.evc.evcperuni.EvcPerUnic;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.mseaunievcservice.mefservices.uni.evc.evcperuni.EvcPerUnin;
+
+/**
+ * A custom implementation of the DefaultEvc - especially its Builder.
+ *
+ * This allows the Evc to be modified after creation. These additions to the
+ * builder are necessary because in the EA1000 YANG model many different Open Flow
+ * flows can be associated with one EVC - each one has its own Ce-Vlan-Id and
+ * Flow Reference
+ */
+public class CustomEvc extends DefaultEvc {
+
+ public static EvcBuilder builder(Evc evc) {
+ return new EvcBuilder(evc);
+ }
+
+ public static class EvcBuilder extends DefaultEvc.EvcBuilder {
+
+ /**
+ * Allow a builder to be constructed from an existing EVC
+ * @param evc An existing EVC
+ */
+ public EvcBuilder(Evc evc) {
+ this.evcPerUni = evc.evcPerUni();
+ this.evcStatus = evc.evcStatus();
+ this.evcIndex = evc.evcIndex();
+ this.mtuSize = evc.mtuSize();
+ this.cevlanCosPreservation = evc.cevlanCosPreservation();
+ this.cevlanIdPreservation = evc.cevlanIdPreservation();
+ this.name = evc.name();
+ this.yangEvcOpType = evc.yangEvcOpType();
+ this.yangAugmentedInfoMap = evc.yangAugmentedInfoMap();
+ this.name = evc.name();
+ this.serviceType = evc.serviceType();
+ this.selectLeafFlags = evc.selectLeafFlags();
+ this.uniEvcId = evc.uniEvcId();
+ this.valueLeafFlags = evc.valueLeafFlags();
+ }
+
+ /**
+ * Method to allow ceVlanMap to be modified.
+ * @param additionalCeVlanMap An addition to the existing ceVlanMap
+ * @param side The Uni Side - Customer or Network
+ * @return The updated builder
+ */
+ public EvcBuilder addToCeVlanMap(ServiceListType additionalCeVlanMap, UniSide side) {
+ evcPerUni = CustomEvcPerUni.builder(evcPerUni).addToCeVlanMap(additionalCeVlanMap, side).build();
+ return this;
+ }
+
+ /**
+ * Method to allow the Flow Mapping list to be modified.
+ * @param fm the flow mapping
+ * @param side The Uni Side - Customer or Network
+ * @return The updated builder
+ */
+ public EvcBuilder addToFlowMapping(FlowMapping fm, UniSide side) {
+ evcPerUni = CustomEvcPerUni.builder(evcPerUni).addToFlowMapping(fm, side).build();
+ return this;
+ }
+
+ /**
+ * Method to allow an EVC side to be added.
+ * @param evcUniN An EVCPerUni object
+ * @return The updated builder
+ */
+ public EvcBuilder addUniN(EvcPerUnin evcUniN) {
+ evcPerUni = CustomEvcPerUni.builder(evcPerUni).addUniN(evcUniN).build();
+ return this;
+ }
+
+ /**
+ * Method to allow an EVC side to be added.
+ * @param evcUniC An EVCPerUni object
+ * @return The updated builder
+ */
+ public EvcBuilder addUniC(EvcPerUnic evcUniC) {
+ evcPerUni = CustomEvcPerUni.builder(evcPerUni).addUniC(evcUniC).build();
+ return this;
+ }
+ }
+}
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/evc/CustomEvcPerUni.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/evc/CustomEvcPerUni.java
new file mode 100644
index 0000000..ed53593
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/evc/CustomEvcPerUni.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service
+ .rev20160317.mseaunievcservice.mefservices.uni.evc;
+
+import org.onosproject.drivers.microsemi.yang.UniSide;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.types
+ .rev20160229.mseatypes.ServiceListType;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.mseaunievcservice.evcperuniextensionattributes.FlowMapping;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service
+ .rev20160317.mseaunievcservice.mefservices.uni.evc.evcperuni.CustomEvcPerUnic;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service
+ .rev20160317.mseaunievcservice.mefservices.uni.evc.evcperuni.CustomEvcPerUnin;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.mseaunievcservice.mefservices.uni.evc.evcperuni.EvcPerUnic;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service.rev20160317.mseaunievcservice.mefservices.uni.evc.evcperuni.EvcPerUnin;
+
+/**
+ * A custom implementation of the DefaultEvcPerUni - especially its Builder.
+ *
+ * This allows the EvcPerUni to be modified after creation. These additions to the
+ * builder are necessary because in the EA1000 YANG model the EvcPerUni side can
+ * be added at separate stages
+ */
+public class CustomEvcPerUni extends DefaultEvcPerUni {
+
+ public static EvcPerUniBuilder builder(EvcPerUni evcPerUni) {
+ return new EvcPerUniBuilder(evcPerUni);
+ }
+
+ public static class EvcPerUniBuilder extends DefaultEvcPerUni.EvcPerUniBuilder {
+
+ /**
+ * Allow a builder to be constructed from an existing EvcPerUni
+ * @param evcPerUni An existing EvcPerUni
+ */
+ public EvcPerUniBuilder(EvcPerUni evcPerUni) {
+ this.evcPerUnic = evcPerUni.evcPerUnic();
+ this.evcPerUnin = evcPerUni.evcPerUnin();
+ this.evcUniType = evcPerUni.evcUniType();
+ this.yangEvcPerUniOpType = evcPerUni.yangEvcPerUniOpType();
+ this.valueLeafFlags = evcPerUni.valueLeafFlags();
+ this.selectLeafFlags = evcPerUni.selectLeafFlags();
+ this.yangAugmentedInfoMap = evcPerUni.yangAugmentedInfoMap();
+ }
+
+ /**
+ * Method to allow ceVlanMap to be modified.
+ * @param additionalCeVlanMap An addition to the existing ceVlanMap
+ * @param side The Uni Side - Customer or Network
+ * @return The updated builder
+ */
+ public EvcPerUniBuilder addToCeVlanMap(ServiceListType additionalCeVlanMap, UniSide side) {
+ if (side == UniSide.NETWORK) {
+ evcPerUnin = CustomEvcPerUnin.builder(evcPerUnin).addToCeVlanMap(additionalCeVlanMap).build();
+ } else {
+ evcPerUnic = CustomEvcPerUnic.builder(evcPerUnic).addToCeVlanMap(additionalCeVlanMap).build();
+ }
+
+ return this;
+ }
+
+ /**
+ * Method to allow the Flow Mapping list to be modified.
+ * @param fm the flow mapping
+ * @param side The Uni Side - Customer or Network
+ * @return The updated builder
+ */
+ public EvcPerUniBuilder addToFlowMapping(FlowMapping fm, UniSide side) {
+ if (side == UniSide.NETWORK) {
+ evcPerUnin = CustomEvcPerUnin.builder(evcPerUnin).addToFlowMapping(fm).build();
+ } else {
+ evcPerUnic = CustomEvcPerUnic.builder(evcPerUnic).addToFlowMapping(fm).build();
+ }
+ return this;
+ }
+
+ /**
+ * Method to allow an EVC side to be added.
+ * @param evcUniN An EVCPerUni object
+ * @return The updated builder
+ */
+ public EvcPerUniBuilder addUniN(EvcPerUnin evcUniN) {
+ this.evcPerUnin = evcUniN;
+ return this;
+ }
+
+ /**
+ * Method to allow an EVC side to be added.
+ * @param evcUniC An EVCPerUni object
+ * @return The updated builder
+ */
+ public EvcPerUniBuilder addUniC(EvcPerUnic evcUniC) {
+ this.evcPerUnic = evcUniC;
+ return this;
+ }
+ }
+}
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/evc/evcperuni/CustomEvcPerUnic.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/evc/evcperuni/CustomEvcPerUnic.java
new file mode 100644
index 0000000..2e8dfc6
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/evc/evcperuni/CustomEvcPerUnic.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service
+ .rev20160317.mseaunievcservice.mefservices.uni.evc.evcperuni;
+
+import org.onosproject.drivers.microsemi.yang.utils.CeVlanMapUtils;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.types
+ .rev20160229.mseatypes.ServiceListType;
+
+/**
+ * A custom implementation of the DefaultEvcPerUnic - especially its Builder.
+ *
+ * This allows the EvcPerUniC to be modified after creation. These additions to the
+ * builder are necessary because in the EA1000 YANG model the EvcPerUniC can
+ * be added at separate stages
+ */
+public class CustomEvcPerUnic extends DefaultEvcPerUnic {
+ public static EvcPerUnicBuilder builder(EvcPerUnic evcPerUnic) {
+ return new EvcPerUnicBuilder(evcPerUnic);
+ }
+
+ public static EvcPerUnicBuilder builder() {
+ return new EvcPerUnicBuilder();
+ }
+
+ public static class EvcPerUnicBuilder extends DefaultEvcPerUnic.EvcPerUnicBuilder {
+
+ /**
+ * Allow a new builder to be constructed
+ */
+ public EvcPerUnicBuilder() {
+ valueLeafFlags.set(LeafIdentifier.CEVLANMAP.getLeafIndex());
+ this.ceVlanMap = new ServiceListType("0");
+ valueLeafFlags.set(LeafIdentifier.INGRESSBWPGROUPINDEX.getLeafIndex());
+ this.ingressBwpGroupIndex = 0;
+ }
+
+ /**
+ * Allow a builder to be constructed from an existing EvcPerUnic
+ * @param evcPerUnic An existing EvcPerUnic
+ */
+ public EvcPerUnicBuilder(EvcPerUnic evcPerUnic) {
+ this.ceVlanMap = evcPerUnic.ceVlanMap();
+ this.evcPerUniServiceType = evcPerUnic.evcPerUniServiceType();
+ this.ingressBwpGroupIndex = evcPerUnic.ingressBwpGroupIndex();
+ this.tagManipulation = evcPerUnic.tagManipulation();
+ this.flowMapping = evcPerUnic.flowMapping();
+ this.yangEvcPerUnicOpType = evcPerUnic.yangEvcPerUnicOpType();
+ this.yangAugmentedInfoMap = evcPerUnic.yangAugmentedInfoMap();
+ this.selectLeafFlags = evcPerUnic.selectLeafFlags();
+ this.valueLeafFlags = evcPerUnic.valueLeafFlags();
+ }
+
+ /**
+ * Method to allow ceVlanMap to be modified.
+ * @param additionalCeVlanMap An addition to the existing ceVlanMap
+ * @return The updated builder
+ */
+ public EvcPerUnicBuilder addToCeVlanMap(ServiceListType additionalCeVlanMap) {
+ String combinedCeVlanMap =
+ CeVlanMapUtils.combineVlanSets(ceVlanMap.string(), additionalCeVlanMap.string());
+ //If it contains 0 we should remove it
+ ceVlanMap = new ServiceListType(
+ CeVlanMapUtils.removeZeroIfPossible(combinedCeVlanMap));
+
+ return this;
+ }
+ }
+}
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/evc/evcperuni/CustomEvcPerUnin.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/evc/evcperuni/CustomEvcPerUnin.java
new file mode 100644
index 0000000..47b438e
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/evc/evcperuni/CustomEvcPerUnin.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service
+ .rev20160317.mseaunievcservice.mefservices.uni.evc.evcperuni;
+
+import org.onosproject.drivers.microsemi.yang.utils.CeVlanMapUtils;
+import org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.types
+ .rev20160229.mseatypes.ServiceListType;
+
+/**
+ * A custom implementation of the DefaultEvcPerUnin - especially its Builder.
+ *
+ * This allows the EvcPerUniN to be modified after creation. These additions to the
+ * builder are necessary because in the EA1000 YANG model the EvcPerUniN can
+ * be added at separate stages
+ */
+public class CustomEvcPerUnin extends DefaultEvcPerUnin {
+ public static EvcPerUninBuilder builder(EvcPerUnin evcPerUnin) {
+ return new EvcPerUninBuilder(evcPerUnin);
+ }
+
+ public static EvcPerUninBuilder builder() {
+ return new EvcPerUninBuilder();
+ }
+
+ public static class EvcPerUninBuilder extends DefaultEvcPerUnin.EvcPerUninBuilder {
+
+ /**
+ * Allow a new builder to be constructed
+ */
+ public EvcPerUninBuilder() {
+ valueLeafFlags.set(LeafIdentifier.CEVLANMAP.getLeafIndex());
+ this.ceVlanMap = new ServiceListType("0");
+ valueLeafFlags.set(LeafIdentifier.INGRESSBWPGROUPINDEX.getLeafIndex());
+ this.ingressBwpGroupIndex = 0;
+ }
+
+ /**
+ * Allow a builder to be constructed from an existing EvcPerUnin
+ * @param evcPerUnin An existing EvcPerUnin
+ */
+ public EvcPerUninBuilder(EvcPerUnin evcPerUnin) {
+ this.ceVlanMap = evcPerUnin.ceVlanMap();
+ this.evcPerUniServiceType = evcPerUnin.evcPerUniServiceType();
+ this.ingressBwpGroupIndex = evcPerUnin.ingressBwpGroupIndex();
+ this.tagManipulation = evcPerUnin.tagManipulation();
+ this.flowMapping = evcPerUnin.flowMapping();
+ this.yangEvcPerUninOpType = evcPerUnin.yangEvcPerUninOpType();
+ this.yangAugmentedInfoMap = evcPerUnin.yangAugmentedInfoMap();
+ this.selectLeafFlags = evcPerUnin.selectLeafFlags();
+ this.valueLeafFlags = evcPerUnin.valueLeafFlags();
+ }
+
+ /**
+ * Method to allow ceVlanMap to be modified.
+ * @param additionalCeVlanMap An addition to the existing ceVlanMap
+ * @return The updated builder
+ */
+ public EvcPerUninBuilder addToCeVlanMap(ServiceListType additionalCeVlanMap) {
+ String combinedCeVlanMap =
+ CeVlanMapUtils.combineVlanSets(ceVlanMap.string(), additionalCeVlanMap.string());
+ //If it contains 0 we should remove it
+ ceVlanMap = new ServiceListType(
+ CeVlanMapUtils.removeZeroIfPossible(combinedCeVlanMap));
+ return this;
+ }
+ }
+}
\ No newline at end of file
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/evc/evcperuni/package-info.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/evc/evcperuni/package-info.java
new file mode 100644
index 0000000..3617d86
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/evc/evcperuni/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Package for Microsemi device drivers support for NETCONF for EA1000.
+ */
+package org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service
+ .rev20160317.mseaunievcservice.mefservices.uni.evc.evcperuni;
\ No newline at end of file
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/evc/package-info.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/evc/package-info.java
new file mode 100644
index 0000000..7813b61
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/evc/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Package for Microsemi device drivers support for NETCONF for EA1000.
+ */
+package org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service
+ .rev20160317.mseaunievcservice.mefservices.uni.evc;
\ No newline at end of file
diff --git a/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/package-info.java b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/package-info.java
new file mode 100644
index 0000000..3bdeda0
--- /dev/null
+++ b/drivers/microsemi/ea1000yang/src/main/java/org/onosproject/yang/gen/v1/http/www/microsemi/com/microsemi/edge/assure/msea/uni/evc/service/rev20160317/mseaunievcservice/mefservices/uni/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Package for Microsemi device drivers support for NETCONF for EA1000.
+ */
+package org.onosproject.yang.gen.v1.http.www.microsemi.com.microsemi.edge.assure.msea.uni.evc.service
+ .rev20160317.mseaunievcservice.mefservices.uni;
\ No newline at end of file