[ONOS-7893] TerminalDevice driver for OpenConfig transponders.
Includes FlowRuleProgrammable and DeviceDiscovery behaviours.
The patch enables the configuration of client and line sides of the transponder.
FlowRules coming from the compilation of OpticalConnectivity and OpticalCircuit intents are translated in proper netconf/xml messages.
The patch also fixes an issue in the OpticalCircuiIntentCompiler to avoid overwriting among generated flowrules in case of bidirectional intents.
The patch also extend optical-rest app to enable deletion of OpticalCircuit intents.
An example of OpenConfig TerminalDevice xml datastore is included.

patch 2: Addressed comments by Ramon Casellas. Checkstyle.

patch 3: Fixed typo in OpticalConnectivityIntentCompiler.

patch 4: Checkstyle.

patch 5: Addressed comments by Andrea Campanella.

patch 6: Introduced Jira tag

patch 7: Update commit message.

patch 8: Ranaming files.

patch 9: Checkstyle.

Change-Id: Ia50bc0877ecd314aaf48cdb8465451a68313ce3a
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
index a484d66..7e873d1 100644
--- a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
@@ -127,6 +127,11 @@
 
     private ApplicationId appId;
 
+    //Priority value of created OpticalConnectivity intent rules.
+    //The OpticalCircuitIntent is created with DEFAULT_INTENT_PRIORITY = 100 (see Intent.java)
+    //The two values have to be different to avoid rules overwriting.
+    private static final int OPTICAL_CONNECTIVITY_INTENT_PRIORITY = 200;
+
     @Modified
     public void modified(ComponentContext context) {
         if (context == null) {
@@ -253,6 +258,7 @@
                     // but `key` field cannot be used for the purpose.
                     .src(srcCP)
                     .dst(dstCP)
+                    .priority(OPTICAL_CONNECTIVITY_INTENT_PRIORITY)
                     .signalType(ochPorts.getLeft().signalType())
                     .bidirectional(intent.isBidirectional())
                     .resourceGroup(intent.resourceGroup())
@@ -320,12 +326,14 @@
         // Create optical circuit intent
         List<FlowRule> rules = new LinkedList<>();
         // at the source: ODUCLT port mapping to OCH port
+        log.debug("OpticalCircuitIntent creating FlowRules");
         rules.add(connectPorts(higherIntent.getSrc(), lowerIntent.getSrc(), higherIntent.priority(), slots));
         // at the destination: OCH port mapping to ODUCLT port
         rules.add(connectPorts(lowerIntent.getDst(), higherIntent.getDst(), higherIntent.priority(), slots));
 
         // Create flow rules for reverse path
         if (higherIntent.isBidirectional()) {
+            log.debug("OpticalCircuitIntent creating FlowRules for reverse path");
            // at the destination: OCH port mapping to ODUCLT port
             rules.add(connectPorts(lowerIntent.getSrc(), higherIntent.getSrc(), higherIntent.priority(), slots));
             // at the source: ODUCLT port mapping to OCH port
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
index dcd97bf..acedda2e 100644
--- a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
@@ -182,6 +182,7 @@
         return OpticalPathIntent.builder()
                 .appId(parentIntent.appId())
                 .key(parentIntent.key())
+                .priority(parentIntent.priority())
                 .src(parentIntent.getSrc())
                 .dst(parentIntent.getDst())
                 .path(path)