Initial import of CFM and SOAM api
Change-Id: Icf5cc2d5fb34b75460e80e8cced0d70265bcd33b
diff --git a/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/EA1000CfmMepProgrammableTest.java b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/EA1000CfmMepProgrammableTest.java
new file mode 100644
index 0000000..1b8135c
--- /dev/null
+++ b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/EA1000CfmMepProgrammableTest.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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;
+
+import static junit.framework.TestCase.fail;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onosproject.drivers.microsemi.yang.utils.MaNameUtil;
+import org.onosproject.incubator.net.l2monitoring.cfm.DefaultMepLbCreate;
+import org.onosproject.incubator.net.l2monitoring.cfm.Mep.Priority;
+import org.onosproject.incubator.net.l2monitoring.cfm.MepEntry;
+import org.onosproject.incubator.net.l2monitoring.cfm.MepLbCreate;
+import org.onosproject.incubator.net.l2monitoring.cfm.RemoteMepEntry.InterfaceStatusTlvType;
+import org.onosproject.incubator.net.l2monitoring.cfm.RemoteMepEntry.PortStatusTlvType;
+import org.onosproject.incubator.net.l2monitoring.cfm.RemoteMepEntry.RemoteMepState;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdCharStr;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdShort;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdCharStr;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId;
+import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException;
+import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.mefcfm.maintenancedomain.MdNameAndTypeCombo;
+import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.mefcfm.maintenancedomain.maintenanceassociation.MaNameAndTypeCombo;
+
+/**
+ * Test of the CFM implementation on EA1000 through the incubator/net/l2monitoring interface.
+ */
+public class EA1000CfmMepProgrammableTest {
+ EA1000CfmMepProgrammable cfmProgrammable;
+ MdId mdId1 = MdIdCharStr.asMdId("md-1");
+ MaIdShort maId11 = MaIdCharStr.asMaId("ma-1-1");
+ MepId mep111 = MepId.valueOf((short) 1);
+
+ @Before
+ public void setUp() throws Exception {
+ cfmProgrammable = new EA1000CfmMepProgrammable();
+ cfmProgrammable.setHandler(new MockEa1000DriverHandler());
+ assertNotNull(cfmProgrammable.handler().data().deviceId());
+ }
+
+
+ @Ignore
+ @Test
+ public void testCreateMep() {
+ fail("Not yet implemented");
+ }
+
+ @Ignore
+ @Test
+ public void testGetAllMeps() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetMep() throws CfmConfigException {
+ MepEntry mepEntry = cfmProgrammable.getMep(mdId1, maId11, mep111);
+
+ //Result will come from MockNetconfSessionEa1000.SAMPLE_MSEACFM_MD_MA_MEP_FULL_REPLY
+ assertNotNull(mepEntry);
+ assertTrue(mepEntry.administrativeState());
+ assertTrue(mepEntry.cciEnabled());
+ assertEquals(Priority.PRIO5.name(), mepEntry.ccmLtmPriority().name());
+
+ assertTrue(mepEntry.activeMacStatusDefect()); //remote-mac-error
+ assertTrue(mepEntry.activeRdiCcmDefect()); //remote-rdi
+
+ assertNotNull(mepEntry.activeRemoteMepList());
+
+ //TODO Comment back in this test - this is a serious issue with onos-yang-tools that only 1 is found
+ // See https://gerrit.onosproject.org/#/c/15164/
+// assertEquals("Expecting 2 Remote Meps", 2, mepEntry.activeRemoteMepList().size());
+ mepEntry.activeRemoteMepList().forEach(rmep -> {
+ if (rmep.remoteMepId().value() == 1) {
+ assertEquals(RemoteMepState.RMEP_FAILED.name(),
+ rmep.state().toString());
+ assertEquals(54654654L, rmep.failedOrOkTime().toMillis());
+ assertEquals("aa:bb:cc:dd:ee:ff".toUpperCase(), rmep.macAddress().toString());
+ assertFalse(rmep.rdi());
+ assertEquals(PortStatusTlvType.PS_NO_STATUS_TLV.name(),
+ rmep.portStatusTlvType().toString());
+ assertEquals(InterfaceStatusTlvType.IS_DORMANT.name(),
+ rmep.interfaceStatusTlvType().toString());
+ }
+ });
+
+ }
+
+ /**
+ * For sampleXmlRegexDeleteMseaCfmMep.
+ * @throws CfmConfigException If an error occurs
+ */
+ @Test
+ public void testDeleteMep() throws CfmConfigException {
+ assertTrue(cfmProgrammable.deleteMep(mdId1, maId11, mep111));
+ }
+
+ /**
+ * For sampleXmlRegexTransmitLoopback.
+ * @throws CfmConfigException If an error occurs
+ */
+ @Test
+ public void testTransmitLoopback() throws CfmConfigException {
+ MepLbCreate.MepLbCreateBuilder lbCreate =
+ DefaultMepLbCreate.builder(MepId.valueOf((short) 12));
+ lbCreate.numberMessages(5);
+// lbCreate.dataTlvHex("AA:BB:CC:DD:EE");
+ lbCreate.vlanPriority(Priority.PRIO3);
+ lbCreate.vlanDropEligible(true);
+
+ cfmProgrammable.transmitLoopback(mdId1, maId11, mep111, lbCreate.build());
+ }
+
+ @Test
+ public void testAbortLoopback() throws CfmConfigException {
+ cfmProgrammable.abortLoopback(mdId1, maId11, mep111);
+ }
+
+// @Test
+// public void testTransmitLinktrace() {
+// fail("Not yet implemented");
+// }
+
+ @Test
+ public void testGetYangMdNameFromApiMdId() throws CfmConfigException {
+ MdNameAndTypeCombo name = EA1000CfmMepProgrammable
+ .getYangMdNameFromApiMdId(MdIdCharStr.asMdId("md-1"));
+
+ assertEquals(org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.mefcfm
+ .maintenancedomain.mdnameandtypecombo
+ .DefaultNameCharacterString.class, name.getClass());
+
+//There's a problem with checkstyle for typecast on really long paths
+// assertEquals("md-1", ((org.onosproject.yang.gen.v1.http.www.microsemi.com
+// .microsemi.edge.assure.msea.cfm.rev20160229.mseacfm.mefcfm
+// .maintenancedomain.mdnameandtypecombo
+// .DefaultNameCharacterString) name).name().string());
+ }
+
+ @Test
+ public void testGetYangMaNameFromApiMaId() throws CfmConfigException {
+ MaNameAndTypeCombo name = MaNameUtil
+ .getYangMaNameFromApiMaId(MaIdCharStr.asMaId("ma-1-1"));
+ assertEquals(org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.mefcfm
+ .maintenancedomain.maintenanceassociation.manameandtypecombo
+ .DefaultNameCharacterString.class, name.getClass());
+
+//There's a problem with checkstyle for typecast on really long paths
+// assertEquals("ma-1-1", ((org.onosproject.yang.gen.v1.http.www.microsemi.com
+// .microsemi.edge.assure.msea.cfm.rev20160229.mseacfm.mefcfm
+// .maintenancedomain.maintenanceassociation.manameandtypecombo
+// .DefaultNameCharacterString) name).name().string());
+ }
+
+}
diff --git a/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/EA1000SoamDmProgrammableTest.java b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/EA1000SoamDmProgrammableTest.java
new file mode 100644
index 0000000..59c674e
--- /dev/null
+++ b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/EA1000SoamDmProgrammableTest.java
@@ -0,0 +1,267 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.Collection;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onosproject.incubator.net.l2monitoring.cfm.Mep.Priority;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdCharStr;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdShort;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdCharStr;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId;
+import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException;
+import org.onosproject.incubator.net.l2monitoring.soam.SoamConfigException;
+import org.onosproject.incubator.net.l2monitoring.soam.SoamId;
+import org.onosproject.incubator.net.l2monitoring.soam.delay.DefaultDelayMeasurementCreate;
+import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate.DmCreateBuilder;
+import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate.DmType;
+import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate.MeasurementOption;
+import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate.Version;
+import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry;
+import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry.SessionStatus;
+
+public class EA1000SoamDmProgrammableTest {
+
+ EA1000SoamDmProgrammable dmProgrammable;
+ MdId mdId1 = MdIdCharStr.asMdId("md-1");
+ MaIdShort maId11 = MaIdCharStr.asMaId("ma-1-1");
+ MepId mep111 = MepId.valueOf((short) 1);
+
+ @Before
+ public void setUp() throws Exception {
+ dmProgrammable = new EA1000SoamDmProgrammable();
+ dmProgrammable.setHandler(new MockEa1000DriverHandler());
+ assertNotNull(dmProgrammable.handler().data().deviceId());
+ }
+
+ //TODO Implement all these tests
+// @Test
+// public void testEA1000SoamDmProgrammable() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testGetAllDms() {
+// fail("Not yet implemented");
+// }
+
+ /**
+ * From SAMPLE_MSEACFM_DELAY_MEASUREMENT_FULL_REPLY.
+ * @throws CfmConfigException
+ * @throws SoamConfigException
+ */
+ @Test
+ public void testGetDm() throws CfmConfigException, SoamConfigException {
+ DelayMeasurementEntry dmEntry =
+ dmProgrammable.getDm(mdId1, maId11, mep111, SoamId.valueOf(1));
+ assertEquals(1, dmEntry.dmId().id().intValue());
+ assertEquals(2, dmEntry.measurementsEnabled().size());
+ assertEquals(SessionStatus.ACTIVE.name(), dmEntry.sessionStatus().name());
+ assertEquals(100, dmEntry.frameDelayTwoWay().toNanos() / 1000);
+ assertEquals(101, dmEntry.interFrameDelayVariationTwoWay().toNanos() / 1000);
+ }
+
+ @Test
+ public void testCreateDm() throws CfmConfigException, SoamConfigException {
+ DmCreateBuilder dmBuilder = (DmCreateBuilder) DefaultDelayMeasurementCreate
+ .builder(DmType.DMDMM, Version.Y17312011,
+ MepId.valueOf((short) 10), Priority.PRIO3)
+ .frameSize((short) 1200);
+
+ dmProgrammable.createDm(mdId1, maId11, mep111, dmBuilder.build());
+ }
+
+ @Test
+ public void testCreateDmWrongMsgPeriod()
+ throws CfmConfigException, SoamConfigException {
+ DmCreateBuilder dmBuilder = (DmCreateBuilder) DefaultDelayMeasurementCreate
+ .builder(DmType.DMDMM, Version.Y17312011,
+ MepId.valueOf((short) 10), Priority.PRIO3)
+ .messagePeriod(Duration.ofMillis(1234));
+
+ try {
+ dmProgrammable.createDm(mdId1, maId11, mep111, dmBuilder.build());
+ fail("Expecting to get an exception");
+ } catch (SoamConfigException e) {
+ assertTrue(e.getMessage()
+ .contains("EA1000 supports only Message Periods"));
+ }
+
+ }
+
+// @Test
+// public void testGetDmCurrentStat() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testGetDmHistoricalStats() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testAbortDmMdIdMaIdShortMepIdSoamId() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testBuildApiDmFromYangDm() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testAbortDmMdIdMaIdShortMepId() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testClearDelayHistoryStatsMdIdMaIdShortMepId() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testClearDelayHistoryStatsMdIdMaIdShortMepIdSoamId() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testGetAllLms() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testGetLm() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testGetLmCurrentStat() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testGetLmHistoricalStats() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testCreateLm() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testAbortLmMdIdMaIdShortMepId() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testAbortLmMdIdMaIdShortMepIdSoamId() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testClearLossHistoryStatsMdIdMaIdShortMepId() {
+// fail("Not yet implemented");
+// }
+//
+// @Test
+// public void testClearLossHistoryStatsMdIdMaIdShortMepIdSoamId() {
+// fail("Not yet implemented");
+// }
+
+ @Test
+ public void testCreateTestSignal() {
+ try {
+ dmProgrammable.createTestSignal(mdId1, maId11, mep111, null);
+ fail("Expected an exception");
+ } catch (UnsupportedOperationException e) {
+ assertEquals("Not supported by EA1000", e.getMessage());
+ } catch (CfmConfigException e) {
+ fail("CfmConfigException was not expected");
+ }
+ }
+
+ @Test
+ public void testAbortTestSignal() {
+ try {
+ dmProgrammable.abortTestSignal(mdId1, maId11, mep111);
+ fail("Expected an exception");
+ } catch (UnsupportedOperationException e) {
+ assertEquals("Not supported by EA1000", e.getMessage());
+ } catch (CfmConfigException e) {
+ fail("CfmConfigException was not expected");
+ }
+ }
+
+ @Test
+ public void testMeasurementEnableCollectionOfMeasurementOption() {
+ BitSet meBs = BitSet.valueOf(new byte[]{0x05});
+ Collection<MeasurementOption> moSet =
+ EA1000SoamDmProgrammable.getMeasurementOptions(meBs);
+ assertTrue(moSet.contains(MeasurementOption.SOAM_PDUS_RECEIVED));
+ assertTrue(moSet.contains(MeasurementOption.FRAME_DELAY_TWO_WAY_MIN));
+ }
+
+ @Test
+ public void testMeasurementEnableBitSetEmpty() {
+ Collection<MeasurementOption> moSet = new ArrayList<>();
+ try {
+ BitSet bitSet = EA1000SoamDmProgrammable.getMeasurementEnabledSet(moSet);
+ assertEquals("{}", bitSet.toString());
+ } catch (SoamConfigException e) {
+ fail("Was not expecting exception here");
+ }
+ }
+
+ @Test
+ public void testMeasurementEnableBitSetInvalid() {
+ Collection<MeasurementOption> moSet = new ArrayList<>();
+ moSet.add(MeasurementOption.FRAME_DELAY_BACKWARD_BINS);
+ moSet.add(MeasurementOption.FRAME_DELAY_RANGE_BACKWARD_AVERAGE);
+ try {
+ EA1000SoamDmProgrammable.getMeasurementEnabledSet(moSet);
+ fail("Was expecting an exception");
+ } catch (SoamConfigException e) {
+ assertTrue(e.getMessage()
+ .contains("Measurement Option is not supported on EA1000"));
+ }
+ }
+
+ @Test
+ public void testMeasurementEnableBitSet2Good() {
+ Collection<MeasurementOption> moSet = new ArrayList<>();
+ moSet.add(MeasurementOption.FRAME_DELAY_TWO_WAY_BINS);
+ moSet.add(MeasurementOption.FRAME_DELAY_TWO_WAY_AVERAGE);
+ try {
+ BitSet bitSet = EA1000SoamDmProgrammable.getMeasurementEnabledSet(moSet);
+ assertEquals("{1, 4}", bitSet.toString());
+ } catch (SoamConfigException e) {
+ fail("Was not expecting exception here");
+ }
+ }
+
+}
diff --git a/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/MockEa1000DriverHandler.java b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/MockEa1000DriverHandler.java
index 75c6811..58a8a5b 100644
--- a/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/MockEa1000DriverHandler.java
+++ b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/MockEa1000DriverHandler.java
@@ -19,14 +19,18 @@
import java.util.Map;
import org.onosproject.core.CoreService;
+import org.onosproject.drivers.microsemi.yang.MockCfmMdService;
+import org.onosproject.drivers.microsemi.yang.MockMseaCfmManager;
import org.onosproject.drivers.microsemi.yang.MockMseaSaFilteringManager;
import org.onosproject.drivers.microsemi.yang.MockMseaUniEvcServiceManager;
import org.onosproject.drivers.microsemi.yang.MockNetconfSessionEa1000;
+import org.onosproject.drivers.microsemi.yang.MseaCfmNetconfService;
import org.onosproject.drivers.microsemi.yang.MseaSaFilteringNetconfService;
import org.onosproject.drivers.microsemi.yang.MseaUniEvcServiceNetconfService;
import org.onosproject.drivers.netconf.MockCoreService;
import org.onosproject.drivers.netconf.MockNetconfController;
import org.onosproject.drivers.netconf.MockNetconfDevice;
+import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService;
import org.onosproject.net.DeviceId;
import org.onosproject.net.driver.Behaviour;
import org.onosproject.net.driver.DefaultDriver;
@@ -53,6 +57,8 @@
private NetconfController ncc;
private MockMseaSaFilteringManager mseaSaFilteringService;
private MockMseaUniEvcServiceManager mseaUniEvcService;
+ private MockMseaCfmManager mseaCfmService;
+ private MockCfmMdService mockMdService;
private CoreService coreService;
public MockEa1000DriverHandler() throws NetconfException {
@@ -63,7 +69,9 @@
Map<String, String> properties = new HashMap<String, String>();
Driver mockDriver =
- new DefaultDriver("mockDriver", null, "ONOSProject", "1.0.0", "1.0.0", behaviours, properties);
+ new DefaultDriver("mockDriver", null,
+ "ONOSProject", "1.0.0",
+ "1.0.0", behaviours, properties);
DeviceId mockDeviceId = DeviceId.deviceId("netconf:1.2.3.4:830");
mockDriverData = new DefaultDriverData(mockDriver, mockDeviceId);
@@ -78,6 +86,12 @@
mseaUniEvcService = new MockMseaUniEvcServiceManager();
mseaUniEvcService.activate();
+ mseaCfmService = new MockMseaCfmManager();
+ mseaCfmService.activate();
+
+ mockMdService = new MockCfmMdService();
+ mockMdService.activate();
+
coreService = new MockCoreService();
coreService.registerApplication(MICROSEMI_DRIVERS);
}
@@ -109,9 +123,14 @@
} else if (serviceClass.equals(MseaUniEvcServiceNetconfService.class)) {
return (T) mseaUniEvcService;
+ } else if (serviceClass.equals(MseaCfmNetconfService.class)) {
+ return (T) mseaCfmService;
+
} else if (serviceClass.equals(CoreService.class)) {
return (T) coreService;
+ } else if (serviceClass.equals(CfmMdService.class)) {
+ return (T) mockMdService;
}
return null;
diff --git a/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MockCfmMdService.java b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MockCfmMdService.java
new file mode 100644
index 0000000..ba6d656
--- /dev/null
+++ b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MockCfmMdService.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.incubator.net.l2monitoring.cfm.DefaultMaintenanceAssociation;
+import org.onosproject.incubator.net.l2monitoring.cfm.DefaultMaintenanceDomain;
+import org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation;
+import org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdCharStr;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdCharStr;
+import org.onosproject.incubator.net.l2monitoring.cfm.impl.CfmMdManager;
+import static org.easymock.EasyMock.*;
+import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException;
+import org.onosproject.incubator.net.l2monitoring.cfm.service.MdStore;
+
+import java.util.Optional;
+
+public class MockCfmMdService extends CfmMdManager {
+
+ @Override
+ public void activate() {
+ store = createMock(MdStore.class);
+
+ try {
+ MaintenanceAssociation ma = DefaultMaintenanceAssociation
+ .builder(MaIdCharStr.asMaId("ma-1-1"), 6)
+ .maNumericId((short) 1)
+ .ccmInterval(MaintenanceAssociation.CcmInterval.INTERVAL_3MS)
+ .build();
+
+ MdId md1Name = MdIdCharStr.asMdId("md-1");
+ MaintenanceDomain md1 = DefaultMaintenanceDomain
+ .builder(md1Name)
+ .mdNumericId((short) 1)
+ .mdLevel(MaintenanceDomain.MdLevel.LEVEL3)
+ .addToMaList(ma)
+ .build();
+
+ expect(store.createUpdateMaintenanceDomain(md1))
+ .andReturn(true);
+ expect(store.getMaintenanceDomain(md1Name))
+ .andReturn(Optional.of(md1)).anyTimes();
+ replay(store);
+
+ } catch (CfmConfigException e) {
+ throw new IllegalArgumentException("Error creating Md md-1 for test");
+ }
+ }
+}
diff --git a/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MockNetconfSessionEa1000.java b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MockNetconfSessionEa1000.java
index 8068cff..d2c07e5 100644
--- a/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MockNetconfSessionEa1000.java
+++ b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MockNetconfSessionEa1000.java
@@ -72,10 +72,23 @@
private Pattern sampleXmlRegexSaFiltering =
Pattern.compile("(<\\?xml).*"
- + "(<rpc).*(<get>).*"
- + "(<filter type=\"subtree\">).*(<source-ipaddress-filtering).*"
- + "(</filter>).*(</get>).*(</rpc>).*"
- + "(]]>){2}", Pattern.DOTALL);
+ + "(<rpc).*(<get>)\\R?"
+ + "(<filter type=\"subtree\">)\\R?"
+ + "(<source-ipaddress-filtering).*(</source-ipaddress-filtering>)\\R?"
+ + "(</filter>)\\R?(</get>)\\R?(</rpc>)\\R?(]]>){2}", Pattern.DOTALL);
+
+ private Pattern sampleXmlRegexSaFilteringErrorScenario =
+ Pattern.compile("(<\\?xml).*"
+ + "(<rpc).*(<get>)\\R?"
+ + "(<filter type=\"subtree\">)\\R?"
+ + "(<source-ipaddress-filtering).*"
+ + "(<interface-eth0>)\\R?"
+ + "(<source-address-range>)\\R?"
+ + "(<range-id>)10(</range-id>)\\R?"
+ + "(</source-address-range>)\\R?"
+ + "(</interface-eth0>)\\R?"
+ + "(</source-ipaddress-filtering>)\\R?"
+ + "(</filter>)\\R?(</get>)\\R?(</rpc>)\\R?(]]>){2}", Pattern.DOTALL);
private Pattern sampleXmlRegexEditConfigSaFilt =
Pattern.compile("(<\\?xml).*(<rpc).*(<edit-config>).*"
@@ -328,7 +341,7 @@
+ "(<maintenance-domain>)\\R?"
+ "(<id/>)\\R?"
+ "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?"
- + "(<md-level/>)\\R?"
+ + "(<md-level/>)?\\R?"
+ "(<maintenance-association>)\\R?"
+ "(<id/>)\\R?"
+ "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?"
@@ -337,19 +350,22 @@
+ "(<component-list/>)\\R?"
+ "(<maintenance-association-end-point>)\\R?"
+ "(<mep-identifier>)[0-9]{1,4}(</mep-identifier>)\\R?"
- + "(<interface/>)\\R?"
- + "(<primary-vid/>)\\R?"
- + "(<administrative-state/>)\\R?"
- + "(<ccm-ltm-priority/>)\\R?"
- + "(<continuity-check/>)\\R?"
- + "(<mac-address/>)\\R?"
- + "(<msea-soam-fm:port-status/>)\\R?"
- + "(<msea-soam-fm:interface-status/>)\\R?"
- + "(<msea-soam-fm:last-defect-sent/>)\\R?"
- + "(<msea-soam-fm:rdi-transmit-status/>)\\R?"
- + "(<loopback/>)\\R?"
- + "(<remote-mep-database/>)\\R?"
- + "(<linktrace/>)\\R?"
+ + "(<mac-address/>)?\\R?"
+ + "((<remote-mep-database>)\\R?"
+ + "(<remote-mep>)\\R?"
+ + "(<remote-mep-id/>)\\R?"
+ + "(</remote-mep>)\\R?"
+ + "(</remote-mep-database>))?\\R?"
+ + "((<msea-soam-pm:delay-measurements>)\\R?"
+ + "(<msea-soam-pm:delay-measurement>)\\R?"
+ + "((<msea-soam-pm:dm-id/>)|(<msea-soam-pm:dm-id>[0-9]*</msea-soam-pm:dm-id>))\\R?"
+ + "(</msea-soam-pm:delay-measurement>)\\R?"
+ + "(</msea-soam-pm:delay-measurements>))?\\R?"
+ + "((<msea-soam-pm:loss-measurements>)\\R?"
+ + "(<msea-soam-pm:loss-measurement>)\\R?"
+ + "((<msea-soam-pm:lm-id/>)|(<msea-soam-pm:lm-id>[0-9]*</msea-soam-pm:lm-id>))\\R?"
+ + "(</msea-soam-pm:loss-measurement>)\\R?"
+ + "(</msea-soam-pm:loss-measurements>))?\\R?"
+ "(</maintenance-association-end-point>)\\R?"
+ "(</maintenance-association>)\\R?"
+ "(</maintenance-domain>)\\R?"
@@ -359,6 +375,164 @@
+ "(</rpc>)\\R?"
+ "(]]>){2}", Pattern.DOTALL);
+ //For testGetConfigMseaCfmEssentials
+ private Pattern sampleXmlRegexGetMseaCfmFull =
+ Pattern.compile("(<\\?xml).*(<rpc).*(<get>)\\R?"
+ + "(<filter type=\"subtree\">)\\R?"
+ + "(<mef-cfm).*"
+ + "(<maintenance-domain>)\\R?"
+ + "(<id/>)\\R?"
+ + "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?"
+ + "(<md-level/>)?\\R?"
+ + "(<maintenance-association>)\\R?"
+ + "(<id/>)\\R?"
+ + "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?"
+ + "(<maintenance-association-end-point>)\\R?"
+ + "(<mep-identifier>)[0-9]{1,4}(</mep-identifier>)\\R?"
+ + "(<interface/>)?\\R?"
+ + "(<primary-vid/>)?\\R?"
+ + "(<administrative-state/>)?\\R?"
+ + "(<mac-address/>)?\\R?"
+ + "(<ccm-ltm-priority/>)?\\R?"
+ + "(<continuity-check/>)?\\R?"
+ + "(<loopback/>)?\\R?"
+ + "(<linktrace/>)?\\R?"
+ + "(<remote-mep-database/>)\\R?"
+ + "(<msea-soam-fm:operational-state/>)\\R?"
+ + "(<msea-soam-fm:connectivity-status/>)\\R?"
+ + "(<msea-soam-fm:port-status/>)\\R?"
+ + "(<msea-soam-fm:interface-status/>)\\R?"
+ + "(<msea-soam-fm:last-defect-sent/>)\\R?"
+ + "(<msea-soam-fm:rdi-transmit-status/>)\\R?"
+ + "(</maintenance-association-end-point>)\\R?"
+ + "(</maintenance-association>)\\R?"
+ + "(</maintenance-domain>)\\R?"
+ + "(</mef-cfm>)\\R?"
+ + "(</filter>)\\R?"
+ + "(</get>)\\R?"
+ + "(</rpc>)\\R?"
+ + "(]]>){2}", Pattern.DOTALL);
+
+ //For testGetConfigMseaCfmEssentials
+ private Pattern sampleXmlRegexGetMseaDelay =
+ Pattern.compile("(<\\?xml).*(<rpc).*(<get>)\\R?"
+ + "(<filter type=\"subtree\">)\\R?"
+ + "(<mef-cfm).*"
+ + "(<maintenance-domain>)\\R?"
+ + "(<id/>)\\R?"
+ + "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?"
+ + "(<maintenance-association>)\\R?"
+ + "(<id/>)\\R?"
+ + "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?"
+ + "(<maintenance-association-end-point>)\\R?"
+ + "(<mep-identifier>)[0-9]{1,4}(</mep-identifier>)\\R?"
+ + "((<msea-soam-pm:delay-measurements>)\\R?"
+ + "(<msea-soam-pm:delay-measurement>)\\R?"
+ + "((<msea-soam-pm:dm-id/>)|(<msea-soam-pm:dm-id>[0-9]*</msea-soam-pm:dm-id>))\\R?"
+ + "(<msea-soam-pm:mep-id/>)\\R?"
+ + "(<msea-soam-pm:mac-address/>)\\R?"
+ + "(<msea-soam-pm:administrative-state/>)\\R?"
+ + "(<msea-soam-pm:measurement-enable/>)\\R?"
+ + "(<msea-soam-pm:message-period/>)\\R?"
+ + "(<msea-soam-pm:priority/>)\\R?"
+ + "(<msea-soam-pm:frame-size/>)\\R?"
+ + "(<msea-soam-pm:measurement-interval/>)\\R?"
+ + "(<msea-soam-pm:number-intervals-stored/>)\\R?"
+ + "(<msea-soam-pm:session-status/>)\\R?"
+ + "(<msea-soam-pm:frame-delay-two-way/>)\\R?"
+ + "(<msea-soam-pm:inter-frame-delay-variation-two-way/>)\\R?"
+ + "(<msea-soam-pm:current-stats/>)?\\R?"
+ + "(<msea-soam-pm:history-stats/>)?\\R?"
+ + "(</msea-soam-pm:delay-measurement>)\\R?"
+ + "(</msea-soam-pm:delay-measurements>))?\\R?"
+ + "(</maintenance-association-end-point>)\\R?"
+ + "(</maintenance-association>)\\R?"
+ + "(</maintenance-domain>)\\R?"
+ + "(</mef-cfm>)\\R?"
+ + "(</filter>)\\R?"
+ + "(</get>)\\R?"
+ + "(</rpc>)\\R?"
+ + "(]]>){2}", Pattern.DOTALL);
+
+ //For testGetConfigMseaCfmEssentials
+ private Pattern sampleXmlRegexDeleteMseaCfmMep =
+ Pattern.compile("(<\\?xml).*(<rpc).*(<edit-config>)\\R?"
+ + "(<target>\\R?<running/>\\R?</target>)\\R?"
+ + "(<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">)\\R?"
+ + "(<mef-cfm).*"
+ + "(<maintenance-domain>)\\R?"
+ + "(<id/>)?\\R?"
+ + "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?"
+ + "(<maintenance-association>)\\R?"
+ + "(<id/>)?\\R?"
+ + "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?"
+ + "(<maintenance-association-end-point nc:operation=\"delete\">)\\R?"
+ + "(<mep-identifier>)[0-9]{1,4}(</mep-identifier>)\\R?"
+ + "(</maintenance-association-end-point>)\\R?"
+ + "(</maintenance-association>)\\R?"
+ + "(</maintenance-domain>)\\R?"
+ + "(</mef-cfm>)\\R?"
+ + "(</config>)\\R?"
+ + "(</edit-config>)\\R?(</rpc>)\\R?(]]>){2}", Pattern.DOTALL);
+
+
+ private Pattern sampleXmlRegexTransmitLoopback =
+ Pattern.compile("(<\\?xml).*(<rpc).*\\R?"
+ + "(<transmit-loopback xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-cfm\">)\\R?"
+ + "((<number-of-messages>)[0-9]*(</number-of-messages>))?\\R?"
+ + "((<data-tlv>)[a-zA-Z0-9+=/]*(</data-tlv>))?\\R?"
+ + "((<vlan-priority>)[0-9]{1}(</vlan-priority>))?\\R?"
+ + "((<vlan-drop-eligible>)((true)|(false))(</vlan-drop-eligible>))?\\R?"
+ + "(<maintenance-association-end-point>)[0-9]{1,4}(</maintenance-association-end-point>)\\R?"
+ + "(<maintenance-association>)[0-9]{1,5}(</maintenance-association>)\\R?"
+ + "(<maintenance-domain>)[0-9]{1,5}(</maintenance-domain>)\\R?"
+ + "(<target-address>)\\R?"
+ + "((<mep-id>)[0-9]{1,4}(</mep-id>))?\\R?"
+ + "((<mac-address>)[a-fA-F0-9:-]{17}(</mac-address>))?\\R?"
+ + "(</target-address>)\\R?"
+ + "(</transmit-loopback>)\\R?"
+ + "(</rpc>)\\R?"
+ + "(]]>){2}", Pattern.DOTALL);
+
+ private Pattern sampleXmlRegexAbortLoopback =
+ Pattern.compile("(<\\?xml).*(<rpc).*\\R?"
+ + "(<abort-loopback xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-cfm\">)\\R?"
+ + "(<maintenance-association-end-point>)[0-9]{1,4}(</maintenance-association-end-point>)\\R?"
+ + "(<maintenance-association>)[0-9]{1,5}(</maintenance-association>)\\R?"
+ + "(<maintenance-domain>)[0-9]{1,5}(</maintenance-domain>)\\R?"
+ + "(</abort-loopback>)\\R?"
+ + "(</rpc>)\\R?"
+ + "(]]>){2}", Pattern.DOTALL);
+
+ //For testCreateDm()
+ private Pattern sampleXmlRegexEditConfigDmCreate =
+ Pattern.compile("(<\\?xml).*(<rpc).*(<edit-config>)\\R?"
+ + "(<target>\\R?<running/>\\R?</target>)\\R?"
+ + "(<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">)\\R?"
+ + "(<mef-cfm xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-cfm\">)\\R?"
+ + "(<maintenance-domain>)\\R?"
+ + "(<id>)[0-9]*(</id>)\\R?"
+ + "(<maintenance-association>)\\R?"
+ + "(<id>)[0-9]*(</id>)\\R?"
+ + "(<maintenance-association-end-point>)\\R?"
+ + "(<mep-identifier>)[0-9]*(</mep-identifier>)\\R?"
+ + "(<delay-measurements xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-soam-pm\">)\\R?"
+ + "(<delay-measurement>)\\R?"
+ + "(<dm-id>)[0-9]*(</dm-id>)\\R?"
+ + "((<administrative-state>)(true|false)(</administrative-state>))?\\R?"
+ + "((<message-period>)(1000ms|100ms|10ms|3ms)(</message-period>))?\\R?"
+ + "(<priority>)[0-9]*(</priority>)\\R?"
+ + "((<frame-size>)[0-9]*(</frame-size>))?\\R?"
+ + "(<mep-id>)[0-9]*(</mep-id>)\\R?"
+ + "(</delay-measurement>)\\R?"
+ + "(</delay-measurements>)\\R?"
+ + "(</maintenance-association-end-point>)\\R?"
+ + "(</maintenance-association>)\\R?"
+ + "(</maintenance-domain>)\\R?"
+ + "(</mef-cfm>)\\R?"
+ + "(</config>)\\R?"
+ + "(</edit-config>)\\R?(</rpc>)\\R?(]]>){2}", Pattern.DOTALL);
+
private static final String SAMPLE_SYSTEM_REPLY = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"1\">\n"
@@ -410,6 +584,17 @@
+ "</data>\n"
+ "</rpc-reply>";
+ private static final String SAMPLE_ERROR_REPLY = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ + "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"1\">\n"
+ + "<rpc-error>"
+ + "<error-type>application</error-type>"
+ + "<error-tag>data-missing</error-tag>"
+ + "<error-severity>error</error-severity>"
+ + "<error-message>Request could not be completed because " +
+ "the relevant data model content does not exist.</error-message>"
+ + "</rpc-error>"
+ + "</rpc-reply>";
+
private static final String SAMPLE_MSEAEVCUNI_REPLY_INIT = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"1\">\n"
+ "<data xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
@@ -592,7 +777,7 @@
+ "</data>\n"
+ "</rpc-reply>";
- private static final String SAMPLE_MSEACFM_MD_MA_MEP_REPLY =
+ private static final String SAMPLE_MSEACFM_MD_MA_MEP_ESSENTIALS_REPLY =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"47\">"
+ "<data>"
@@ -602,72 +787,41 @@
+ "<maintenance-domain>"
+ "<id>1</id>"
+ "<name>md-1</name>"
- + "<md-level>3</md-level>"
+ "<maintenance-association>"
+ "<id>1</id>"
+ "<name>ma-1-1</name>"
- + "<ccm-interval>10ms</ccm-interval>" //Causing problems on create of MA
- + "<remote-meps>1</remote-meps>"
- + "<remote-meps>2</remote-meps>"
- + "<component-list>"
- + "<vid>100</vid>"
- + "<tag-type>vlan-stag</tag-type>"
- + "</component-list>"
+ "<maintenance-association-end-point>"
+ "<mep-identifier>1</mep-identifier>"
- + "<interface>eth1</interface>"
- + "<primary-vid>100</primary-vid>"
- + "<administrative-state>true</administrative-state>"
- + "<ccm-ltm-priority>4</ccm-ltm-priority>"
- + "<continuity-check>"
- + "<cci-enabled>true</cci-enabled>"
- + "<fng-state>report-defect</fng-state>"
- + "<highest-priority-defect-found>remote-mac-error</highest-priority-defect-found>"
- + "<active-defects> remote-mac-error invalid-ccm</active-defects>"
- + "<last-error-ccm>U2FtcGxlIGxhc3QgZXJyb3IgY2NtAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
- + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
- + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
- + "AAAAAAAAAAAAAAAAAAAAAAAAAAAA==</last-error-ccm>"
- + "<ccm-sequence-error-count>10</ccm-sequence-error-count>"
- + "<sent-ccms>15</sent-ccms>"
- + "</continuity-check>"
- + "<mac-address>53:65:61:6e:20:43</mac-address>"
- + "<msea-soam-fm:port-status>no-status-tlv</msea-soam-fm:port-status>"
- + "<msea-soam-fm:interface-status>no-status-tlv</msea-soam-fm:interface-status>"
-// + "<msea-soam-fm:last-defect-sent/>" --Can't handle this at the moment
- + "<msea-soam-fm:rdi-transmit-status>false</msea-soam-fm:rdi-transmit-status>"
- + "<loopback>"
- + "<replies-received>123</replies-received>"
- + "<replies-transmitted>456</replies-transmitted>"
- + "</loopback>"
+ + "<mac-address>00:b0:ae:03:ff:31</mac-address>"
+ "<remote-mep-database>"
+ "<remote-mep>"
+ + "<remote-mep-id>1</remote-mep-id>"
+ + "</remote-mep>"
+ + "<remote-mep>"
+ "<remote-mep-id>2</remote-mep-id>"
- + "<remote-mep-state>ok</remote-mep-state>"
- + "<failed-ok-time>1490692834</failed-ok-time>"
- + "<mac-address>53:65:61:6e:20:43</mac-address>"
- + "<rdi>true</rdi>"
- + "<port-status-tlv>up</port-status-tlv>"
- + "<interface-status-tlv>dormant</interface-status-tlv>"
+ "</remote-mep>"
+ "</remote-mep-database>"
- + "<linktrace>"
- + "<unexpected-replies-received>0</unexpected-replies-received>"
- + "<msea-soam-fm:ltm-msgs-transmitted>2</msea-soam-fm:ltm-msgs-transmitted>"
- + "<msea-soam-fm:ltm-msgs-received>2</msea-soam-fm:ltm-msgs-received>"
- + "<msea-soam-fm:ltr-msgs-transmitted>2</msea-soam-fm:ltr-msgs-transmitted>"
- + "<msea-soam-fm:ltr-msgs-received>2</msea-soam-fm:ltr-msgs-received>"
- + "<linktrace-database/>"
- + "</linktrace>"
+ + "<msea-soam-pm:delay-measurements>"
+ + "<msea-soam-pm:delay-measurement>"
+ + "<msea-soam-pm:dm-id>1</msea-soam-pm:dm-id>"
+ + "</msea-soam-pm:delay-measurement>"
+ + "</msea-soam-pm:delay-measurements>"
+ + "<msea-soam-pm:loss-measurements>"
+ + "<msea-soam-pm:loss-measurement>"
+ + "<msea-soam-pm:lm-id>1</msea-soam-pm:lm-id>"
+ + "</msea-soam-pm:loss-measurement>"
+ + "<msea-soam-pm:loss-measurement>"
+ + "<msea-soam-pm:lm-id>2</msea-soam-pm:lm-id>"
+ + "</msea-soam-pm:loss-measurement>"
+ + "</msea-soam-pm:loss-measurements>"
+ "</maintenance-association-end-point>"
- + "<remote-meps>4</remote-meps>"
+ "</maintenance-association>"
+ "</maintenance-domain>"
+ "</mef-cfm>"
+ "</data>"
+ "</rpc-reply>";
- private static final String SAMPLE_MSEACFM_MD_MA_MEP_REPLY2 =
+ private static final String SAMPLE_MSEACFM_MD_MA_MEP_FULL_REPLY =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"47\">"
+ "<data>"
@@ -676,63 +830,100 @@
+ "xmlns:msea-soam-pm=\"http://www.microsemi.com/microsemi-edge-assure/msea-soam-pm\">"
+ "<maintenance-domain>"
+ "<id>1</id>"
- + "<name>Microsemi</name>"
- + "<md-level>2</md-level>"
+ + "<name>md-1</name>"
+ "<maintenance-association>"
+ "<id>1</id>"
- + "<name>example-ma</name>"
- + "<remote-meps>1</remote-meps>"
- + "<remote-meps>2</remote-meps>"
- + "<component-list>"
- + "<vid>100</vid>"
- + "<tag-type>vlan-stag</tag-type>"
- + "</component-list>"
+ + "<name>ma-1-1</name>"
+ + "<ccm-interval>3.3ms</ccm-interval>"
+ "<maintenance-association-end-point>"
- + "<mep-identifier>4</mep-identifier>"
- + "<interface>eth1</interface>"
- + "<primary-vid>100</primary-vid>"
+ + "<mep-identifier>1</mep-identifier>"
+ + "<interface>eth0</interface>"
+ + "<primary-vid>20</primary-vid>"
+ "<administrative-state>true</administrative-state>"
- + "<ccm-ltm-priority>4</ccm-ltm-priority>"
+ + "<mac-address>00:b0:ae:03:ff:31</mac-address>"
+ + "<ccm-ltm-priority>5</ccm-ltm-priority>"
+ "<continuity-check>"
+ "<cci-enabled>true</cci-enabled>"
+ "<fng-state>defect-reported</fng-state>"
+ "<highest-priority-defect-found>remote-invalid-ccm</highest-priority-defect-found>"
-// + "<active-defects> remote-invalid-ccm</active-defects>"
- + "<active-defects/>"
+ + "<active-defects>remote-rdi remote-invalid-ccm</active-defects>"
+ "<ccm-sequence-error-count>0</ccm-sequence-error-count>"
- + "<sent-ccms>41013</sent-ccms>"
+ + "<sent-ccms>197</sent-ccms>"
+ "</continuity-check>"
- + "<mac-address>00:b0:ae:03:ff:31</mac-address>"
+ + "<loopback>"
+ + "</loopback>"
+ + "<linktrace>"
+ + "</linktrace>"
+ + "<remote-mep-database>"
+ + "<remote-mep>"
+ + "<remote-mep-id>1</remote-mep-id>"
+ + "<remote-mep-state>failed</remote-mep-state>"
+ + "<failed-ok-time>54654654</failed-ok-time>"
+ + "<mac-address>aa:bb:cc:dd:ee:ff</mac-address>"
+ + "<rdi>false</rdi>"
+ + "<port-status-tlv>no-status-tlv</port-status-tlv>"
+ + "<interface-status-tlv>dormant</interface-status-tlv>"
+ + "</remote-mep>"
+ + "<remote-mep>"
+ + "<remote-mep-id>2</remote-mep-id>"
+ + "<remote-mep-state>failed</remote-mep-state>"
+ + "<failed-ok-time>54654654</failed-ok-time>"
+ + "<mac-address>aa:bb:cc:dd:ee:ff</mac-address>"
+ + "<rdi>false</rdi>"
+ + "<port-status-tlv>no-status-tlv</port-status-tlv>"
+ + "<interface-status-tlv>dormant</interface-status-tlv>"
+ + "</remote-mep>"
+ + "</remote-mep-database>"
+ + "<msea-soam-fm:operational-state>enabled</msea-soam-fm:operational-state>"
+ + "<msea-soam-fm:connectivity-status>partially-active</msea-soam-fm:connectivity-status>"
+ "<msea-soam-fm:port-status>up</msea-soam-fm:port-status>"
+ "<msea-soam-fm:interface-status>up</msea-soam-fm:interface-status>"
+ + "<msea-soam-fm:last-defect-sent>remote-rdi remote-mac-error</msea-soam-fm:last-defect-sent>"
+ "<msea-soam-fm:rdi-transmit-status>true</msea-soam-fm:rdi-transmit-status>"
- + "<loopback>"
- + "<replies-received>0</replies-received>"
- + "<replies-transmitted>0</replies-transmitted>"
- + "</loopback>"
- + "<remote-mep-database>"
- + "<remote-mep>"
- + "<remote-mep-id>1</remote-mep-id>"
- + "<remote-mep-state>failed</remote-mep-state>"
- + "<failed-ok-time>26315533</failed-ok-time>"
- + "<mac-address>00:00:00:00:00:00</mac-address>"
- + "<rdi>false</rdi>"
- + "<port-status-tlv>no-status-tlv</port-status-tlv>"
- + "<interface-status-tlv>no-status-tlv</interface-status-tlv>"
- + "</remote-mep>"
- + "<remote-mep>"
- + "<remote-mep-id>2</remote-mep-id>"
- + "<remote-mep-state>failed</remote-mep-state>"
- + "<failed-ok-time>26315541</failed-ok-time>"
- + "<mac-address>00:00:00:00:00:00</mac-address>"
- + "<rdi>false</rdi>"
- + "<port-status-tlv>no-status-tlv</port-status-tlv>"
- + "<interface-status-tlv>no-status-tlv</interface-status-tlv>"
- + "</remote-mep>"
- + "</remote-mep-database>"
- + "<linktrace />"
+ "</maintenance-association-end-point>"
- + "<remote-meps>4</remote-meps>"
+ + "</maintenance-association>"
+ + "</maintenance-domain>"
+ + "</mef-cfm>"
+ + "</data>"
+ + "</rpc-reply>";
+
+ private static final String SAMPLE_MSEACFM_DELAY_MEASUREMENT_FULL_REPLY =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ + "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"47\">"
+ + "<data>"
+ + "<mef-cfm xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-cfm\" "
+ + "xmlns:msea-soam-fm=\"http://www.microsemi.com/microsemi-edge-assure/msea-soam-fm\" "
+ + "xmlns:msea-soam-pm=\"http://www.microsemi.com/microsemi-edge-assure/msea-soam-pm\">"
+ + "<maintenance-domain>"
+ + "<id>1</id>"
+ + "<name>md-1</name>"
+ + "<maintenance-association>"
+ + "<id>1</id>"
+ + "<name>ma-1-1</name>"
+ + "<maintenance-association-end-point>"
+ + "<mep-identifier>1</mep-identifier>"
+ + "<msea-soam-pm:delay-measurements>"
+ + "<msea-soam-pm:delay-measurement>"
+ + "<msea-soam-pm:dm-id>1</msea-soam-pm:dm-id>"
+ + "<msea-soam-pm:mep-id>10</msea-soam-pm:mep-id>"
+ + "<msea-soam-pm:administrative-state>true</msea-soam-pm:administrative-state>"
+ + "<msea-soam-pm:measurement-enable>frame-delay-two-way-bins "
+ + "frame-delay-two-way-max</msea-soam-pm:measurement-enable>"
+ + "<msea-soam-pm:message-period>3ms</msea-soam-pm:message-period>"
+ + "<msea-soam-pm:priority>6</msea-soam-pm:priority>"
+ + "<msea-soam-pm:frame-size>1000</msea-soam-pm:frame-size>"
+ + "<msea-soam-pm:measurement-interval>15</msea-soam-pm:measurement-interval>"
+ + "<msea-soam-pm:number-intervals-stored>32</msea-soam-pm:number-intervals-stored>"
+ + "<msea-soam-pm:session-status>active</msea-soam-pm:session-status>"
+ + "<msea-soam-pm:frame-delay-two-way>100</msea-soam-pm:frame-delay-two-way>"
+ + "<msea-soam-pm:inter-frame-delay-variation-two-way>101</msea-soam-pm:inter-frame-delay-variation-two-way>"
+// + "<msea-soam-pm:current-stats>"
+// + "</msea-soam-pm:current-stats>"
+// + "<msea-soam-pm:history-stats>"
+// + "</msea-soam-pm:history-stats>"
+ + "</msea-soam-pm:delay-measurement>"
+ + "</msea-soam-pm:delay-measurements>"
+ + "</maintenance-association-end-point>"
+ "</maintenance-association>"
+ "</maintenance-domain>"
+ "</mef-cfm>"
@@ -966,6 +1157,9 @@
} else if (sampleXmlRegex2.matcher(request).matches()) {
return SAMPLE_SYSTEM_REPLY_INIT;
+ } else if (sampleXmlRegexSaFilteringErrorScenario.matcher(request).matches()) {
+ return SAMPLE_ERROR_REPLY;
+
} else if (sampleXmlRegexSaFiltering.matcher(request).matches()) {
return SAMPLE_MSEASAFILTERING_FE_REPLY;
@@ -1009,7 +1203,25 @@
return SAMPLE_REPLY_OK;
} else if (sampleXmlRegexGetMseaCfmEssentials.matcher(request).matches()) {
- return SAMPLE_MSEACFM_MD_MA_MEP_REPLY2;
+ return SAMPLE_MSEACFM_MD_MA_MEP_ESSENTIALS_REPLY;
+
+ } else if (sampleXmlRegexGetMseaCfmFull.matcher(request).matches()) {
+ return SAMPLE_MSEACFM_MD_MA_MEP_FULL_REPLY;
+
+ } else if (sampleXmlRegexDeleteMseaCfmMep.matcher(request).matches()) {
+ return SAMPLE_REPLY_OK;
+
+ } else if (sampleXmlRegexGetMseaDelay.matcher(request).matches()) {
+ return SAMPLE_MSEACFM_DELAY_MEASUREMENT_FULL_REPLY;
+
+ } else if (sampleXmlRegexEditConfigDmCreate.matcher(request).matches()) {
+ return SAMPLE_REPLY_OK;
+
+ } else if (sampleXmlRegexTransmitLoopback.matcher(request).matches()) {
+ return SAMPLE_REPLY_OK;
+
+ } else if (sampleXmlRegexAbortLoopback.matcher(request).matches()) {
+ return SAMPLE_REPLY_OK;
} else {
throw new NetconfException("MocknetconfSession. No sendRequest() case for query: " +
diff --git a/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MseaCfmManagerTest.java b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MseaCfmManagerTest.java
index 2908d53..fe99bf3 100644
--- a/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MseaCfmManagerTest.java
+++ b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MseaCfmManagerTest.java
@@ -26,18 +26,42 @@
import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
+import org.onosproject.drivers.microsemi.yang.MseaCfmNetconfService.DmEntryParts;
import org.onosproject.drivers.microsemi.yang.impl.MseaCfmManager;
+import org.onosproject.drivers.microsemi.yang.utils.MepIdUtil;
+import org.onosproject.drivers.microsemi.yang.utils.MepIdUtil2;
+import org.onosproject.drivers.microsemi.yang.utils.MepIdUtil3;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdCharStr;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdCharStr;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId;
+import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException;
+import org.onosproject.incubator.net.l2monitoring.soam.SoamId;
import org.onosproject.netconf.NetconfDeviceInfo;
import org.onosproject.netconf.NetconfException;
import org.onosproject.netconf.NetconfSession;
+import org.onosproject.yang.gen.v1.ietfyangtypes.rev20130715.ietfyangtypes.MacAddress;
import org.onosproject.yang.gen.v1.mseacfm.rev20160229.MseaCfm;
import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.DefaultMefCfm;
import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.MefCfm;
+import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.abortloopback.AbortLoopbackInput;
+import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.abortloopback.DefaultAbortLoopbackInput;
import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.mefcfm.DefaultMaintenanceDomain;
import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.mefcfm.MaintenanceDomain;
+import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.mefcfm.maintenancedomain.maintenanceassociation.MaintenanceAssociationEndPoint;
import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.mefcfm.maintenancedomain.mdnameandtypecombo.DefaultNameCharacterString;
import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.mefcfm.maintenancedomain.mdnameandtypecombo.NameCharacterString;
+import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.targetaddressgroup.AddressType;
+import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.targetaddressgroup.addresstype.DefaultMacAddress;
+import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.targetaddressgroup.addresstype.DefaultMepId;
+import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.transmitloopback.DefaultTransmitLoopbackInput;
+import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.transmitloopback.TransmitLoopbackInput;
+import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.transmitloopback.transmitloopbackinput.DefaultTargetAddress;
+import org.onosproject.yang.gen.v1.mseasoampm.rev20160229.mseasoampm.mefcfm.maintenancedomain.maintenanceassociation.maintenanceassociationendpoint.augmentedmseacfmmaintenanceassociationendpoint.delaymeasurements.DelayMeasurement;
+import org.onosproject.yang.gen.v1.mseasoampm.rev20160229.mseasoampm.mefcfm.maintenancedomain.maintenanceassociation.maintenanceassociationendpoint.augmentedmseacfmmaintenanceassociationendpoint.lossmeasurements.lossmeasurement.MessagePeriodEnum;
+import org.onosproject.yang.gen.v1.mseasoampm.rev20160229.mseasoampm.sessionstatustype.SessionStatusTypeEnum;
import org.onosproject.yang.gen.v1.mseatypes.rev20160229.mseatypes.Identifier45;
+import org.onosproject.yang.gen.v1.mseatypes.rev20160229.mseatypes.MepIdType;
+import org.onosproject.yang.gen.v1.mseatypes.rev20160229.mseatypes.PriorityType;
public class MseaCfmManagerTest {
@@ -52,7 +76,8 @@
} catch (UncheckedIOException e) {
fail(e.getMessage());
}
- NetconfDeviceInfo deviceInfo = new NetconfDeviceInfo("netconf", "netconf", Ip4Address.valueOf("1.2.3.4"), 830);
+ NetconfDeviceInfo deviceInfo = new NetconfDeviceInfo("netconf", "netconf",
+ Ip4Address.valueOf("1.2.3.4"), 830);
session = new MockNetconfSessionEa1000(deviceInfo);
}
@@ -61,13 +86,92 @@
}
@Test
- public void testGetConfigMseaCfmEssentials() throws NetconfException {
- MseaCfm mseaCfm = mseaCfmService.getMepEssentials("md-1", "ma-1-1", 1, session);
+ public void testGetConfigMseaCfmEssentials()
+ throws NetconfException, CfmConfigException {
+ MseaCfm mseaCfm = mseaCfmService.getMepEssentials(
+ MdIdCharStr.asMdId("md-1"),
+ MaIdCharStr.asMaId("ma-1-1"),
+ MepId.valueOf((short) 1), session);
assertNotNull(mseaCfm);
- //See SAMPLE_MSEACFM_MD_MA_MEP_REPLY in MockNetconfSessionEa1000
+ //See SAMPLE_MSEACFM_MD_MA_MEP_ESSENTIALS_REPLY in MockNetconfSessionEa1000
assertEquals(1, mseaCfm.mefCfm().maintenanceDomain().size());
- assertEquals(2, mseaCfm.mefCfm().maintenanceDomain().get(0).mdLevel().uint8());
+ }
+
+ @Test
+ public void testGetConfigMseaCfmFull()
+ throws NetconfException, CfmConfigException {
+ MseaCfm mseaCfm = mseaCfmService.getMepFull(
+ MdIdCharStr.asMdId("md-1"),
+ MaIdCharStr.asMaId("ma-1-1"),
+ MepId.valueOf((short) 1), session);
+ assertNotNull(mseaCfm);
+
+ //See SAMPLE_MSEACFM_MD_MA_MEP_FULL_REPLY in MockNetconfSessionEa1000
+ assertEquals(1, mseaCfm.mefCfm().maintenanceDomain().size());
+ MaintenanceAssociationEndPoint mep = mseaCfm.mefCfm()
+ .maintenanceDomain().get(0)
+ .maintenanceAssociation().get(0)
+ .maintenanceAssociationEndPoint().get(0);
+ assertTrue(mep.administrativeState());
+ assertEquals("00:b0:ae:03:ff:31", mep.macAddress().toString());
+
+ org.onosproject.yang.gen.v1.mseasoamfm.rev20160229.mseasoamfm.mefcfm.maintenancedomain
+ .maintenanceassociation.maintenanceassociationendpoint
+ .AugmentedMseaCfmMaintenanceAssociationEndPoint augmentedMep =
+ MepIdUtil2.convertFmAugmentedMep(mep);
+
+ assertEquals("partially-active", augmentedMep.connectivityStatus().toString());
+ assertEquals("up", augmentedMep.interfaceStatus().enumeration().toString());
+ }
+
+ /**
+ * Driven by SAMPLE_MSEACFM_DELAY_MEASUREMENT_FULL_REPLY.
+ * @throws NetconfException If there's a problem
+ */
+ @Test
+ public void testGetSoamDm() throws NetconfException {
+ MseaCfm mseaCfmWithDm = mseaCfmService.getSoamDm(
+ MdIdCharStr.asMdId("md-1"),
+ MaIdCharStr.asMaId("ma-1-1"),
+ MepId.valueOf((short) 1),
+ SoamId.valueOf(1),
+ DmEntryParts.ALL_PARTS, session);
+
+ assertNotNull(mseaCfmWithDm);
+ MaintenanceAssociationEndPoint mep = mseaCfmWithDm.mefCfm()
+ .maintenanceDomain().get(0)
+ .maintenanceAssociation().get(0)
+ .maintenanceAssociationEndPoint().get(0);
+
+ //Because of a checkstyle problem with typecasts including really long
+ //package names, this has to be handed off to a different class
+ org.onosproject.yang.gen.v1.mseasoampm.rev20160229.mseasoampm.mefcfm.maintenancedomain
+ .maintenanceassociation.maintenanceassociationendpoint
+ .AugmentedMseaCfmMaintenanceAssociationEndPoint augmentedMep =
+ MepIdUtil.convertPmAugmentedMep(mep);
+
+ DelayMeasurement dm = augmentedMep.delayMeasurements().delayMeasurement().get(0);
+ assertEquals(true, dm.administrativeState());
+ assertTrue(dm.measurementEnable().get(3)); //frame-delay-two-way-bins
+ assertTrue(dm.measurementEnable().get(1)); //frame-delay-two-way-max
+
+ assertEquals(MessagePeriodEnum.YANGAUTOPREFIX3MS.name(), dm.messagePeriod().name());
+ assertEquals(6, dm.priority().uint8());
+ assertEquals(1000, dm.frameSize());
+ assertEquals(15, dm.measurementInterval());
+ assertEquals(32, dm.numberIntervalsStored());
+ assertEquals(SessionStatusTypeEnum.ACTIVE.name(),
+ dm.sessionStatus().enumeration().name());
+ assertEquals(100, dm.frameDelayTwoWay().uint32());
+ assertEquals(101, dm.interFrameDelayVariationTwoWay().uint32());
+
+ //The remoteMep of the DM is a choice, which for mepId is a leafref object
+ org.onosproject.yang.gen.v1.mseasoampm.rev20160229.mseasoampm.remotemepgroup.remotemep
+ .DefaultMepId remoteMepId = MepIdUtil3.convertPmRemoteMepToMepId(dm.remoteMep());
+ assertNotNull(remoteMepId);
+ assertEquals(10, ((MepIdType) remoteMepId.mepId()).uint16());
+
}
/**
@@ -91,20 +195,67 @@
}
@Test
- public void testTransmitLoopback() throws NetconfException {
+ /**
+ * Using Remote remote MEP ID and all arguments.
+ */
+ public void testTransmitLoopback1() {
+ TransmitLoopbackInput lbTr1 = new DefaultTransmitLoopbackInput();
+ lbTr1.maintenanceDomain(Short.valueOf((short) 1));
+ lbTr1.maintenanceAssociation(Short.valueOf((short) 2));
+ lbTr1.maintenanceAssociationEndPoint(Short.valueOf((short) 3));
+
+ DefaultTargetAddress ta = new DefaultTargetAddress();
+ DefaultMepId mepId = new DefaultMepId();
+ mepId.mepId(MepIdType.of(4));
+ ta.addressType((AddressType) mepId);
+ lbTr1.targetAddress(ta);
+
+// lbTr1.dataTlv(new byte[]{0x01, 0x02, 0x03}); Not supported in onos-yang-tools just yet
+ lbTr1.numberOfMessages(10);
+ lbTr1.vlanDropEligible(true);
+ lbTr1.vlanPriority(PriorityType.of((short) 1));
try {
- mseaCfmService.transmitLoopback(null, session);
- } catch (UnsupportedOperationException e) {
- assertTrue(e.getMessage().contains("Not yet implemented"));
+ mseaCfmService.transmitLoopback(lbTr1, session);
+ } catch (NetconfException e) {
+ fail("Calling of TransmitLoopback failed: " + e.getMessage());
+ }
+ }
+
+ @Test
+ /**
+ * Using Remote Mac address in place of remote MEP ID and fewer arguments.
+ */
+ public void testTransmitLoopback2() {
+ TransmitLoopbackInput lbTr2 = new DefaultTransmitLoopbackInput();
+
+ lbTr2.maintenanceDomain(Short.valueOf((short) 63));
+ lbTr2.maintenanceAssociation(Short.valueOf((short) 62));
+ lbTr2.maintenanceAssociationEndPoint(Short.valueOf((short) 61));
+
+ DefaultTargetAddress ta = new DefaultTargetAddress();
+ DefaultMacAddress macAddr = new DefaultMacAddress();
+ macAddr.macAddress(MacAddress.of("FF:EE:DD:CC:BB:AA"));
+ ta.addressType(macAddr);
+ lbTr2.targetAddress(ta);
+ try {
+ mseaCfmService.transmitLoopback(lbTr2, session);
+ } catch (NetconfException e) {
+ fail("Calling of TransmitLoopback failed: " + e.getMessage());
}
}
@Test
public void testAbortLoopback() throws NetconfException {
+ AbortLoopbackInput lbAbort = new DefaultAbortLoopbackInput();
+
+ lbAbort.maintenanceDomain((short) 70);
+ lbAbort.maintenanceAssociation((short) 71);
+ lbAbort.maintenanceAssociationEndPoint((short) 72);
+
try {
- mseaCfmService.abortLoopback(null, session);
- } catch (UnsupportedOperationException e) {
- assertTrue(e.getMessage().contains("Not yet implemented"));
+ mseaCfmService.abortLoopback(lbAbort, session);
+ } catch (NetconfException e) {
+ fail("Calling of AbortLoopback failed: " + e.getMessage());
}
}
diff --git a/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MseaSaFilteringManagerTest.java b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MseaSaFilteringManagerTest.java
index 1a3e779..29ac4a3 100644
--- a/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MseaSaFilteringManagerTest.java
+++ b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MseaSaFilteringManagerTest.java
@@ -18,6 +18,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
+import static org.junit.Assert.assertTrue;
import java.io.UncheckedIOException;
import java.util.List;
@@ -85,6 +86,32 @@
}
}
+ /**
+ * See sampleXmlRegexSaFilteringErrorScenario in MockNetconfSessionEa1000.
+ */
+ @Test
+ public void testGetMseaSaFilteringMseaSaFilteringOpParamNetconfSessionError() {
+
+ SourceAddressRange sar = new DefaultSourceAddressRange();
+ sar.rangeId((short) 10);
+
+ InterfaceEth0 eth0 = new DefaultInterfaceEth0();
+ eth0.addToSourceAddressRange(sar);
+
+ SourceIpaddressFiltering sip = new DefaultSourceIpaddressFiltering();
+ sip.interfaceEth0(eth0);
+
+ MseaSaFilteringOpParam mseaSaFilteringConfig = new MseaSaFilteringOpParam();
+ mseaSaFilteringConfig.sourceIpaddressFiltering(sip);
+
+ try {
+ MseaSaFiltering result = mseaSaSvc.getMseaSaFiltering(mseaSaFilteringConfig, session);
+ fail("Should have thrown exception");
+ } catch (NetconfException ne) {
+ assertTrue(ne.getMessage().startsWith("NETCONF rpc-error"));
+ }
+ }
+
@Test
public void testSetMseaSaFilteringMseaSaFilteringOpParamNetconfSessionNcDsType() {