Bgp and Pcep maintaiability
Change-Id: I2c14cc29d4900ef2f0fbffd4761b0d78e282910f
diff --git a/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepCfg.java b/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepCfg.java
new file mode 100644
index 0000000..a6aa623
--- /dev/null
+++ b/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepCfg.java
@@ -0,0 +1,56 @@
+/*
+ * 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.pcep.controller;
+
+/**
+ * PCEP peer state information.
+ */
+
+public interface PcepCfg {
+
+ State getState();
+
+ void setState(State state);
+
+ enum State {
+ /**
+ * Signifies that its just created.
+ */
+ INIT,
+
+ /**
+ * Signifies that only IP Address is configured.
+ */
+ OPENWAIT,
+
+ /**
+ * Signifies that only Autonomous System is configured.
+ */
+ KEEPWAIT,
+
+ /**
+ * Signifies that both IP and Autonomous System is configured.
+ */
+ ESTABLISHED,
+
+ /**
+ * Signifies that both IP and Autonomous System is down.
+ */
+ DOWN
+ }
+
+}
diff --git a/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepClientController.java b/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepClientController.java
index 9f02b8b..7ced035 100644
--- a/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepClientController.java
+++ b/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepClientController.java
@@ -15,9 +15,6 @@
*/
package org.onosproject.pcep.controller;
-import java.util.Collection;
-import java.util.LinkedList;
-
import org.onosproject.incubator.net.tunnel.DefaultLabelStack;
import org.onosproject.incubator.net.tunnel.LabelStack;
import org.onosproject.incubator.net.tunnel.Tunnel;
@@ -25,6 +22,11 @@
import org.onosproject.pcepio.protocol.PcepMessage;
import org.onosproject.pcepio.types.PcepValueType;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
/**
* Abstraction of an Pcep client controller. Serves as a one stop
* shop for obtaining Pcep devices and (un)register listeners
@@ -135,4 +137,41 @@
* @return list of ERO sub-objects
*/
public LinkedList<PcepValueType> createPcepLabelStack(DefaultLabelStack labelStack, Path path);
+
+ /**
+ * Returns list of PCEP exceptions.
+ *
+ * @return PcepExceptions
+ */
+ public Map<String, List<String>> getPcepExceptions();
+
+ /**
+ * Returns all the pcep error messages received .
+ *
+ * @return PcepErrorMsg
+ */
+ public Map<Integer, Integer> getPcepErrorMsg();
+
+ /**
+ * Returns the pcep session details.
+ *
+ * @return PcepSession
+ */
+ public Map<String, String> getPcepSessionMap();
+
+ /**
+ * Returns the pcep sessionid information.
+ *
+ * @return PcepSessionId
+ */
+ public Map<String, Byte> getPcepSessionIdMap();
+
+ /**
+ * Creates detailed information about pcep error value and type per peer.
+ *
+ * @param peerId id of the peer which sent the error message
+ * @param errorType the error type of the error message received
+ * @param errValue the error value of the error message received
+ */
+ void peerErrorMsg(String peerId, Integer errorType, Integer errValue);
}
diff --git a/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepErrorDetail.java b/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepErrorDetail.java
new file mode 100644
index 0000000..febf74f
--- /dev/null
+++ b/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepErrorDetail.java
@@ -0,0 +1,108 @@
+/*
+ * 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.pcep.controller;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * PCEP error message details.
+ */
+public class PcepErrorDetail {
+
+ private Map<Integer, String> sessionEstablishmentFailureMap = new TreeMap<>();
+ private Map<Integer, String> unknownObjectMap = new TreeMap<>();
+ private Map<Integer, String> notSupportedObjectMap = new TreeMap<>();
+ private Map<Integer, String> policyViolationMap = new TreeMap<>();
+ private Map<Integer, String> mandatoryObjectMissingMap = new TreeMap<>();
+ private Map<Integer, String> receptionOfInvalidObjectMap = new TreeMap<>();
+ private Map<Integer, String> invalidOperationMap = new TreeMap<>();
+
+
+ public Map sessionEstablishmentFailure() {
+ sessionEstablishmentFailureMap.put(1, "Reception of an invalid Open message or a non Open message.");
+ sessionEstablishmentFailureMap.put(2, "no Open message received before the expiration of the OpenWait timer");
+ sessionEstablishmentFailureMap.put(3, "unacceptable and non-negotiable session characteristics");
+ sessionEstablishmentFailureMap.put(4, "unacceptable but negotiable session characteristics");
+ sessionEstablishmentFailureMap.put(5, "reception of a second Open message with still " +
+ "unacceptable session characteristics");
+ sessionEstablishmentFailureMap.put(6, "reception of a PCErr message proposing unacceptable " +
+ "session characteristics");
+ sessionEstablishmentFailureMap.put(7, "No Keepalive or PCErr message received before the " +
+ "expiration of the KeepWait timer");
+ sessionEstablishmentFailureMap.put(8, "PCEP version not supported");
+ return sessionEstablishmentFailureMap;
+ }
+
+
+ public Map unknownObject() {
+ unknownObjectMap.put(1, "Unrecognized object class");
+ unknownObjectMap.put(2, "Unrecognized object type");
+ return unknownObjectMap;
+ }
+
+ public Map notSupportedObject() {
+ notSupportedObjectMap.put(1, "Not Supported object class");
+ notSupportedObjectMap.put(2, "Not Supported object type");
+ return notSupportedObjectMap;
+ }
+
+
+ public Map policyViolation() {
+ policyViolationMap.put(1, "C bit of the METRIC object set (request rejected)");
+ policyViolationMap.put(2, "O bit of the RP object cleared (request rejected)");
+ return policyViolationMap;
+ }
+
+
+
+ public Map mandatoryObjectMissing() {
+ mandatoryObjectMissingMap.put(1, "RP object missing");
+ mandatoryObjectMissingMap.put(2, "RRO missing for a re-optimization request (R bit of the RP object set)");
+ mandatoryObjectMissingMap.put(2, "END-POINTS object missing");
+ return mandatoryObjectMissingMap;
+
+ }
+
+
+ public Map receptionOfInvalidObject() {
+ receptionOfInvalidObjectMap.put(1, "reception of an object with P flag not set although the P flag must be" +
+ "set according to this specification.");
+ return receptionOfInvalidObjectMap;
+ }
+
+ public Map invalidOperation() {
+ invalidOperationMap.put(1, "Attempted LSP Update Request for a non-delegated LSP. The PCEP-ERROR Object" +
+ " is followed by the LSP Object that identifies the LSP.");
+ invalidOperationMap.put(2, "Attempted LSP Update Request if the" +
+ " stateful PCE capability was not" +
+ " advertised.");
+ invalidOperationMap.put(3, "Attempted LSP Update Request for an LSP" +
+ "identified by an unknown PLSP-ID.");
+ invalidOperationMap.put(4, "A PCE indicates to a PCC that it has" +
+ " exceeded the resource limit allocated" +
+ " for its state, and thus it cannot" +
+ " accept and process its LSP State Report" +
+ " message.");
+ invalidOperationMap.put(5, "Attempted LSP State Report if active" +
+ " stateful PCE capability was not" +
+ " advertised.");
+ return invalidOperationMap;
+ }
+
+
+
+}
diff --git a/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepErrorType.java b/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepErrorType.java
new file mode 100644
index 0000000..de68061
--- /dev/null
+++ b/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepErrorType.java
@@ -0,0 +1,54 @@
+/*
+ * 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.pcep.controller;
+
+/**
+ * PCEP error message type information.
+ */
+public enum PcepErrorType {
+ SESSIONESTABLISHMENTFAILURE(1),
+ CAPABALITYNOTSUPPORTED(2),
+ UNKNOWNOBJECT(3),
+ NOTSUPPORTEDOBJECT(4),
+ POLICYVIOLATION(5),
+ MANDATORYOBJECTMISSING(6),
+ SYNCHRONIZEDPATHCOMPUTATIONREQUESTMISSING(7),
+ UNKNOWNREQUESTREFERENCE(8),
+ ESTABLISHINGSECONDPCEPSESSION(9),
+ RECEPTIONOFINVALIDOBJECT(10),
+ INVALIDOPERATION(19),
+ VIRTUALNETWORKTLVMISSING(255);
+
+ public int value;
+
+ /**
+ * Creates an instance of Pcep Error Type.
+ *
+ * @param value represents Error type
+ */
+ PcepErrorType(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value representing Pcep Error Type.
+ *
+ * @return value represents Error Type
+ */
+ public int value() {
+ return value;
+ }
+}
\ No newline at end of file