Cleaning up unused code in Microsemi driver
Change-Id: If7e9790d9141324dff084e41d040ba0132141de8
diff --git a/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/IetfSystemNetconfService.java b/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/IetfSystemNetconfService.java
index 32e77b1..d72050e 100644
--- a/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/IetfSystemNetconfService.java
+++ b/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/IetfSystemNetconfService.java
@@ -20,14 +20,8 @@
import org.onosproject.netconf.DatastoreId;
import org.onosproject.netconf.NetconfException;
import org.onosproject.netconf.NetconfSession;
-import org.onosproject.yang.gen.v1.ietfsystemmicrosemi.rev20160505.ietfsystemmicrosemi.doupgradeandreboot.DoUpgradeAndRebootInput;
-import org.onosproject.yang.gen.v1.ietfsystemmicrosemi.rev20160505.ietfsystemmicrosemi.doupgradeandreboot.DoUpgradeAndRebootOutput;
-import org.onosproject.yang.gen.v1.ietfsystemmicrosemi.rev20160505.ietfsystemmicrosemi.pullupdatetarfromtftp.PullUpdateTarFromTftpInput;
-import org.onosproject.yang.gen.v1.ietfsystemmicrosemi.rev20160505.ietfsystemmicrosemi.readfromsyslog.ReadFromSyslogInput;
-import org.onosproject.yang.gen.v1.ietfsystemmicrosemi.rev20160505.ietfsystemmicrosemi.readfromsyslog.ReadFromSyslogOutput;
import org.onosproject.yang.gen.v1.ietfsystem.rev20140806.IetfSystem;
import org.onosproject.yang.gen.v1.ietfsystem.rev20140806.IetfSystemOpParam;
-import org.onosproject.yang.gen.v1.ietfsystem.rev20140806.ietfsystem.systemrestart.SystemRestartInput;
/**
* Extension of ietfSystemService to include NETCONF sessions.
@@ -76,15 +70,6 @@
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
@@ -92,36 +77,4 @@
*/
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/src/main/java/org/onosproject/drivers/microsemi/yang/MicrosemiModelRegistrator.java b/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/MicrosemiModelRegistrator.java
deleted file mode 100644
index a075d83..0000000
--- a/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/MicrosemiModelRegistrator.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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 com.google.common.collect.ImmutableMap;
-import org.apache.felix.scr.annotations.Component;
-import org.onosproject.yang.AbstractYangModelRegistrator;
-import org.onosproject.yang.gen.v1.entitystatetcmib.rev20051122.EntityStateTcMib;
-import org.onosproject.yang.gen.v1.fpgainternal.rev20151130.FpgaInternal;
-import org.onosproject.yang.gen.v1.ianacrypthash.rev20140806.IanaCryptHash;
-import org.onosproject.yang.gen.v1.ianaiftype.rev20140508.IanaIfType;
-import org.onosproject.yang.gen.v1.ieeetypes.rev20080522.IeeeTypes;
-import org.onosproject.yang.gen.v1.ietfinettypes.rev20130715.IetfInetTypes;
-import org.onosproject.yang.gen.v1.ietfinterfaces.rev20140508.IetfInterfaces;
-import org.onosproject.yang.gen.v1.ietfnetconf.rev20110601.IetfNetconf;
-import org.onosproject.yang.gen.v1.ietfnetconfacm.rev20120222.IetfNetconfAcm;
-import org.onosproject.yang.gen.v1.ietfnetconfmonitoring.rev20101004.IetfNetconfMonitoring;
-import org.onosproject.yang.gen.v1.ietfnetconfnotifications.rev20120206.IetfNetconfNotifications;
-import org.onosproject.yang.gen.v1.ietfnetconfwithdefaults.rev20100609.IetfNetconfWithDefaults;
-import org.onosproject.yang.gen.v1.ietfsystem.rev20140806.IetfSystem;
-import org.onosproject.yang.gen.v1.ietfsystemmicrosemi.rev20160505.IetfSystemMicrosemi;
-import org.onosproject.yang.gen.v1.ietfsystemtlsauth.rev20140524.IetfSystemTlsAuth;
-import org.onosproject.yang.gen.v1.ietfx509certtoname.rev20130326.IetfX509CertToName;
-import org.onosproject.yang.gen.v1.ietfyangtypes.rev20130715.IetfYangTypes;
-import org.onosproject.yang.gen.v1.mseacfm.rev20160229.MseaCfm;
-import org.onosproject.yang.gen.v1.mseasafiltering.rev20160412.MseaSaFiltering;
-import org.onosproject.yang.gen.v1.mseasoamfm.rev20160229.MseaSoamFm;
-import org.onosproject.yang.gen.v1.mseasoampm.rev20160229.MseaSoamPm;
-import org.onosproject.yang.gen.v1.mseatypes.rev20160229.MseaTypes;
-import org.onosproject.yang.gen.v1.mseaunievcinterface.rev20160317.MseaUniEvcInterface;
-import org.onosproject.yang.gen.v1.mseaunievcservice.rev20160317.MseaUniEvcService;
-import org.onosproject.yang.gen.v1.ncnotifications.rev20080714.NcNotifications;
-import org.onosproject.yang.gen.v1.netopeercfgnetopeer.rev20130214.NetopeerCfgnetopeer;
-import org.onosproject.yang.gen.v1.notifications.rev20080714.Notifications;
-import org.onosproject.yang.gen.v1.rfc2544.rev20151020.Rfc2544;
-import org.onosproject.yang.gen.v1.svcactivationtypes.rev20151027.SvcActivationTypes;
-import org.onosproject.yang.gen.v1.y1564.rev20151029.Y1564;
-import org.onosproject.yang.model.DefaultYangModuleId;
-import org.onosproject.yang.model.YangModuleId;
-import org.onosproject.yang.runtime.AppModuleInfo;
-import org.onosproject.yang.runtime.DefaultAppModuleInfo;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Representation of Microsemi model registrator which registers Microsemi device
- * models.
- */
-@Component(immediate = true)
-public class MicrosemiModelRegistrator extends AbstractYangModelRegistrator {
-
- public MicrosemiModelRegistrator() {
- super(IetfSystem.class, getAppInfo());
- }
-
- private static Map<YangModuleId, AppModuleInfo> getAppInfo() {
- Map<YangModuleId, AppModuleInfo> appInfo = new HashMap<>();
-
- appInfo.put(new DefaultYangModuleId("fpga-internal", "2015-11-30"),
- new DefaultAppModuleInfo(FpgaInternal.class, null));
- appInfo.put(new DefaultYangModuleId("iana-if-type", "2014-05-08"),
- new DefaultAppModuleInfo(IanaIfType.class, null));
- appInfo.put(new DefaultYangModuleId("ietf-yang-types", "2013-07-15"),
- new DefaultAppModuleInfo(IetfYangTypes.class, null));
- appInfo.put(new DefaultYangModuleId("msea-sa-filtering", "2016-04-12"),
- new DefaultAppModuleInfo(MseaSaFiltering.class, null));
- appInfo.put(new DefaultYangModuleId("ietf-x509-cert-to-name", "2013-03-26"),
- new DefaultAppModuleInfo(IetfX509CertToName.class, null));
- appInfo.put(new DefaultYangModuleId("ietf-system", "2014-08-06"),
- new DefaultAppModuleInfo(IetfSystem.class, null));
- appInfo.put(new DefaultYangModuleId("msea-types", "2016-02-29"),
- new DefaultAppModuleInfo(MseaTypes.class, null));
- appInfo.put(new DefaultYangModuleId("ietf-inet-types", "2013-07-15"),
- new DefaultAppModuleInfo(IetfInetTypes.class, null));
- appInfo.put(new DefaultYangModuleId("ietf-netconf-with-defaults", "2010-06-09"),
- new DefaultAppModuleInfo(IetfNetconfWithDefaults.class, null));
- appInfo.put(new DefaultYangModuleId("msea-uni-evc-service", "2016-03-17"),
- new DefaultAppModuleInfo(MseaUniEvcService.class, null));
- appInfo.put(new DefaultYangModuleId("ietf-netconf-monitoring", "2010-10-04"),
- new DefaultAppModuleInfo(IetfNetconfMonitoring.class, null));
- appInfo.put(new DefaultYangModuleId("ietf-netconf-acm", "2012-02-22"),
- new DefaultAppModuleInfo(IetfNetconfAcm.class, null));
- appInfo.put(new DefaultYangModuleId("ietf-system-tls-auth", "2014-05-24"),
- new DefaultAppModuleInfo(IetfSystemTlsAuth.class, null));
- appInfo.put(new DefaultYangModuleId("rfc-2544", "2015-10-20"),
- new DefaultAppModuleInfo(Rfc2544.class, null));
- appInfo.put(new DefaultYangModuleId("msea-cfm", "2016-02-29"),
- new DefaultAppModuleInfo(MseaCfm.class, null));
- appInfo.put(new DefaultYangModuleId("netopeer-cfgnetopeer", "2013-02-14"),
- new DefaultAppModuleInfo(NetopeerCfgnetopeer.class, null));
- appInfo.put(new DefaultYangModuleId("ENTITY-STATE-TC-MIB", "2005-11-22"),
- new DefaultAppModuleInfo(EntityStateTcMib.class, null));
- appInfo.put(new DefaultYangModuleId("msea-soam-fm", "2016-02-29"),
- new DefaultAppModuleInfo(MseaSoamFm.class, null));
- appInfo.put(new DefaultYangModuleId("ietf-netconf-notifications", "2012-02-06"),
- new DefaultAppModuleInfo(IetfNetconfNotifications.class, null));
- appInfo.put(new DefaultYangModuleId("nc-notifications", "2008-07-14"),
- new DefaultAppModuleInfo(NcNotifications.class, null));
- appInfo.put(new DefaultYangModuleId("iana-crypt-hash", "2014-08-06"),
- new DefaultAppModuleInfo(IanaCryptHash.class, null));
- appInfo.put(new DefaultYangModuleId("msea-uni-evc-interface", "2016-03-17"),
- new DefaultAppModuleInfo(MseaUniEvcInterface.class, null));
- appInfo.put(new DefaultYangModuleId("msea-soam-pm", "2016-02-29"),
- new DefaultAppModuleInfo(MseaSoamPm.class, null));
- appInfo.put(new DefaultYangModuleId("ieee-types", "2008-05-22"),
- new DefaultAppModuleInfo(IeeeTypes.class, null));
- appInfo.put(new DefaultYangModuleId("svc-activation-types", "2015-10-27"),
- new DefaultAppModuleInfo(SvcActivationTypes.class, null));
- appInfo.put(new DefaultYangModuleId("ietf-netconf", "2011-06-01"),
- new DefaultAppModuleInfo(IetfNetconf.class, null));
- appInfo.put(new DefaultYangModuleId("ietf-system-microsemi", "2016-05-05"),
- new DefaultAppModuleInfo(IetfSystemMicrosemi.class, null));
- appInfo.put(new DefaultYangModuleId("notifications", "2008-07-14"),
- new DefaultAppModuleInfo(Notifications.class, null));
- appInfo.put(new DefaultYangModuleId("y-1564", "2015-10-29"),
- new DefaultAppModuleInfo(Y1564.class, null));
- appInfo.put(new DefaultYangModuleId("ietf-interfaces", "2014-05-08"),
- new DefaultAppModuleInfo(IetfInterfaces.class, null));
- return ImmutableMap.copyOf(appInfo);
- }
-}
diff --git a/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/impl/AbstractYangServiceImpl.java b/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/impl/AbstractYangServiceImpl.java
index 27c1e86..074aad4 100644
--- a/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/impl/AbstractYangServiceImpl.java
+++ b/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/impl/AbstractYangServiceImpl.java
@@ -76,15 +76,12 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected YangModelRegistry yangModelRegistry;
-// @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-// protected SchemaContextProvider schemaContextProvider;
-
protected ApplicationId appId;
// xSer is not a service and is a class variable. Can be lost on deactivate.
// Must be recreated on activate
- protected XmlSerializer xSer;
- protected YangSerializerContext yCtx;
+ protected XmlSerializer xSer = null;
+ protected YangSerializerContext yCtx = null;
protected static final Pattern REGEX_XML_HEADER =
Pattern.compile("(<\\?xml).*(\\?>)", Pattern.DOTALL);
@@ -107,11 +104,8 @@
@Activate
public void activate() {
Set<YangSerializer> yangSer = ((YangSerializerRegistry) yangModelRegistry).getSerializers();
- yangSer.forEach(ser -> {
- if (ser instanceof XmlSerializer) {
- xSer = (XmlSerializer) ser;
- }
- });
+ xSer = (XmlSerializer) yangSer.stream()
+ .filter(ser -> (ser instanceof XmlSerializer)).findFirst().get();
SchemaContext context = ((SchemaContextProvider) yangModelRegistry)
.getSchemaContext(ResourceId.builder().addBranchPointSchema("/", null).build());
diff --git a/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/impl/IetfSystemManager.java b/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/impl/IetfSystemManager.java
index 0e8f4bd..9a8b471 100644
--- a/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/impl/IetfSystemManager.java
+++ b/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/impl/IetfSystemManager.java
@@ -29,14 +29,8 @@
import org.onosproject.netconf.NetconfSession;
import org.onosproject.yang.gen.v1.ietfsystem.rev20140806.ietfsystem.DefaultSystem;
import org.onosproject.yang.gen.v1.ietfsystem.rev20140806.ietfsystem.DefaultSystemState;
-import org.onosproject.yang.gen.v1.ietfsystemmicrosemi.rev20160505.ietfsystemmicrosemi.doupgradeandreboot.DoUpgradeAndRebootInput;
-import org.onosproject.yang.gen.v1.ietfsystemmicrosemi.rev20160505.ietfsystemmicrosemi.doupgradeandreboot.DoUpgradeAndRebootOutput;
-import org.onosproject.yang.gen.v1.ietfsystemmicrosemi.rev20160505.ietfsystemmicrosemi.pullupdatetarfromtftp.PullUpdateTarFromTftpInput;
-import org.onosproject.yang.gen.v1.ietfsystemmicrosemi.rev20160505.ietfsystemmicrosemi.readfromsyslog.ReadFromSyslogInput;
-import org.onosproject.yang.gen.v1.ietfsystemmicrosemi.rev20160505.ietfsystemmicrosemi.readfromsyslog.ReadFromSyslogOutput;
import org.onosproject.yang.gen.v1.ietfsystem.rev20140806.IetfSystem;
import org.onosproject.yang.gen.v1.ietfsystem.rev20140806.IetfSystemOpParam;
-import org.onosproject.yang.gen.v1.ietfsystem.rev20140806.ietfsystem.systemrestart.SystemRestartInput;
import org.onosproject.yang.model.DefaultModelObjectData;
import org.onosproject.yang.model.ModelConverter;
import org.onosproject.yang.model.ModelObject;
@@ -146,34 +140,10 @@
}
@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.
@@ -186,9 +156,10 @@
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>");
+//FIXME: This has been commented out until the augment of common models issue with onos-yang-tools is sorted
+// 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/>");
diff --git a/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/impl/MseaCfmManager.java b/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/impl/MseaCfmManager.java
index 43be669..695dfcb 100644
--- a/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/impl/MseaCfmManager.java
+++ b/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/yang/impl/MseaCfmManager.java
@@ -35,7 +35,6 @@
import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.abortloopback.AbortLoopbackInput;
import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.mefcfm.MaintenanceDomain;
import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.mefcfm.maintenancedomain.MaintenanceAssociation;
-import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.mefcfm.maintenancedomain.maintenanceassociation.CcmIntervalEnum;
import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.mefcfm.maintenancedomain.maintenanceassociation.MaintenanceAssociationEndPoint;
import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.transmitlinktrace.TransmitLinktraceInput;
import org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.transmitlinktrace.TransmitLinktraceOutput;
@@ -43,7 +42,6 @@
import org.onosproject.yang.gen.v1.mseasoampm.rev20160229.mseasoampm.mefcfm.maintenancedomain.maintenanceassociation.maintenanceassociationendpoint.AugmentedMseaCfmMaintenanceAssociationEndPoint;
import org.onosproject.yang.gen.v1.mseasoampm.rev20160229.mseasoampm.mefcfm.maintenancedomain.maintenanceassociation.maintenanceassociationendpoint.DefaultAugmentedMseaCfmMaintenanceAssociationEndPoint;
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.model.DefaultModelObjectData;
import org.onosproject.yang.model.ModelConverter;
import org.onosproject.yang.model.ModelObject;
@@ -56,6 +54,7 @@
import org.onosproject.yang.runtime.DefaultCompositeStream;
import java.io.ByteArrayInputStream;
+import java.util.regex.Pattern;
/**
* Implementation of the MseaCfmServiceNetconf YANG model service.
@@ -69,6 +68,16 @@
public static final String MSEA_CFM_NS = "http://www.microsemi.com/microsemi-edge-assure/msea-cfm";
public static final String MSEA_CFM_PM_NS = "http://www.microsemi.com/microsemi-edge-assure/msea-soam-pm";
+
+ //FIXME Remove when the issue with Null bits on onos-yang-tools is sorted
+ @Deprecated
+ protected static final Pattern REGEX_EMPTY_ACTIVE_DEFECTS =
+ Pattern.compile("(<active-defects)[ ]?(/>)", Pattern.DOTALL);
+ //FIXME Remove when the issue with Null bits on onos-yang-tools is sorted
+ @Deprecated
+ protected static final Pattern REGEX_EMPTY_LAST_DEFECT_SENT =
+ Pattern.compile("(<msea-soam-fm:last-defect-sent)[ ]?(/>)", Pattern.DOTALL);
+
@Activate
public void activate() {
super.activate();
@@ -96,7 +105,6 @@
String xmlResult = session.get(xmlQueryStr, null);
xmlResult = removeRpcReplyData(xmlResult);
- xmlResult = removePrefixedMessagePeriod(xmlResult);
DefaultCompositeStream resultDcs = new DefaultCompositeStream(
null, new ByteArrayInputStream(xmlResult.getBytes()));
CompositeData compositeData = xSer.decode(resultDcs, yCtx);
@@ -127,7 +135,7 @@
String xmlResult = session.get(xmlQueryStr, null);
xmlResult = removeRpcReplyData(xmlResult);
- xmlResult = removePrefixedCcmInterval(xmlResult);
+ xmlResult = removeEmptyActiveDefects(xmlResult);
DefaultCompositeStream resultDcs = new DefaultCompositeStream(
null, new ByteArrayInputStream(xmlResult.getBytes()));
CompositeData compositeData = xSer.decode(resultDcs, yCtx);
@@ -155,7 +163,6 @@
String xmlResult = session.get(xmlQueryStr, null);
xmlResult = removeRpcReplyData(xmlResult);
- xmlResult = removePrefixedMessagePeriod(xmlResult);
DefaultCompositeStream resultDcs = new DefaultCompositeStream(
null, new ByteArrayInputStream(xmlResult.getBytes()));
CompositeData compositeData = xSer.decode(resultDcs, yCtx);
@@ -287,6 +294,16 @@
throw new UnsupportedOperationException("Not yet implemented");
}
+ //FIXME Remove when the fix for null bits with onos-yang-tools
+ // https://gerrit.onosproject.org/#/c/15777/ is available
+ @Deprecated
+ private static String removeEmptyActiveDefects(String rpcReplyXml) throws NetconfException {
+ rpcReplyXml = REGEX_EMPTY_ACTIVE_DEFECTS.matcher(rpcReplyXml).replaceFirst("");
+ rpcReplyXml = REGEX_EMPTY_LAST_DEFECT_SENT.matcher(rpcReplyXml).replaceFirst("");
+
+ return rpcReplyXml;
+ }
+
@Deprecated //Replace this with a ModelObject defintion
private String buildMepEssentialsQueryString(MdId mdId, MaIdShort maId,
MepId mepId) {
@@ -435,29 +452,4 @@
return rpc.toString();
}
-
- private static final String removePrefixedMessagePeriod(String xmlResult) {
- xmlResult = xmlResult.replace("message-period>3ms</",
- "message-period>" + MessagePeriodEnum.YANGAUTOPREFIX3MS.toString() + "</");
- xmlResult = xmlResult.replace("message-period>10ms</",
- "message-period>" + MessagePeriodEnum.YANGAUTOPREFIX10MS.toString() + "</");
- xmlResult = xmlResult.replace("message-period>100ms</",
- "message-period>" + MessagePeriodEnum.YANGAUTOPREFIX100MS.toString() + "</");
- xmlResult = xmlResult.replace("message-period>1000ms</",
- "message-period>" + MessagePeriodEnum.YANGAUTOPREFIX1000MS.toString() + "</");
- return xmlResult;
- }
-
- private static final String removePrefixedCcmInterval(String xmlResult) {
- xmlResult = xmlResult.replace("ccm-interval>3.3ms</",
- "ccm-interval>" + CcmIntervalEnum.YANGAUTOPREFIX3_3MS.toString() + "</");
- xmlResult = xmlResult.replace("ccm-interval>10ms</",
- "ccm-interval>" + CcmIntervalEnum.YANGAUTOPREFIX10MS.toString() + "</");
- xmlResult = xmlResult.replace("ccm-interval>100ms</",
- "ccm-interval>" + CcmIntervalEnum.YANGAUTOPREFIX100MS.toString() + "</");
- xmlResult = xmlResult.replace("ccm-interval>1s</",
- "ccm-interval>" + CcmIntervalEnum.YANGAUTOPREFIX1S.toString() + "</");
- return xmlResult;
- }
-
}