Implements [CORD-546]
Changes:
- Adds new l2 tunnel and l2 tunnel policy;
- Extends cfg of the apps;
- Implements CRUD interfaces through netcfg;
Change-Id: I1a295da605e2496f4883f63fa5f6eca16e627d43
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/pwaas/L2TunnelHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/pwaas/L2TunnelHandler.java
new file mode 100644
index 0000000..96fe6c9
--- /dev/null
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/pwaas/L2TunnelHandler.java
@@ -0,0 +1,76 @@
+/*
+ * 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.segmentrouting.pwaas;
+
+import org.onosproject.net.config.NetworkConfigEvent;
+import org.onosproject.segmentrouting.SegmentRoutingManager;
+import org.onosproject.segmentrouting.config.PwaasConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Handles pwaas related events.
+ */
+public class L2TunnelHandler {
+ private static final Logger log = LoggerFactory.getLogger(L2TunnelHandler.class);
+ private static final String CONFIG_NOT_FOUND = "Pwaas config not found";
+ private static final String NOT_MASTER = "Not master controller";
+ private final SegmentRoutingManager srManager;
+
+ public L2TunnelHandler(SegmentRoutingManager srManager) {
+ this.srManager = srManager;
+ }
+
+ /**
+ * Processes Pwaas Config added event.
+ *
+ * @param event network config added event
+ */
+ public void processPwaasConfigAdded(NetworkConfigEvent event) {
+ log.info("Processing Pwaas CONFIG_ADDED");
+ PwaasConfig config = (PwaasConfig) event.config().get();
+ config.getPwIds().forEach(pwId -> {
+ log.info("{}", config.getPwDescription(pwId));
+ });
+ }
+
+ /**
+ * Processes Pwaas Config updated event.
+ *
+ * @param event network config updated event
+ */
+ public void processPwaasConfigUpdated(NetworkConfigEvent event) {
+ log.info("Processing Pwaas CONFIG_UPDATED");
+ PwaasConfig config = (PwaasConfig) event.config().get();
+ config.getPwIds().forEach(pwId -> {
+ log.info("{}", config.getPwDescription(pwId));
+ });
+ }
+
+ /**
+ * Processes Pwaas Config removed event.
+ *
+ * @param event network config removed event
+ */
+ public void processPwaasConfigRemoved(NetworkConfigEvent event) {
+ log.info("Processing Pwaas CONFIG_REMOVED");
+ PwaasConfig config = (PwaasConfig) event.config().get();
+ config.getPwIds().forEach(pwId -> {
+ log.info("{}", config.getPwDescription(pwId));
+ });
+ }
+}