Migrate implementation/neutron/southbound to IETF YANG model
[lispflowmapping.git] / mappingservice / implementation / src / main / java / org / opendaylight / lispflowmapping / implementation / mdsal / DataStoreBackEnd.java
index 51ba251a2f6fa2b97d0602d25f9edfc2135d9ef9..5435a4edc684a59728be95b9e3a9e95353e5987f 100644 (file)
@@ -21,7 +21,7 @@ import org.opendaylight.lispflowmapping.lisp.util.LispAddressStringifier;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingDatabase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.InstanceId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -45,41 +45,41 @@ public class DataStoreBackEnd {
     }
 
     public void addAuthenticationKey(AuthenticationKey authenticationKey) {
-        LOG.debug("MD-SAL: Adding authentication key '{}' for {}", authenticationKey.getAuthkey(),
-                LispAddressStringifier.getString(authenticationKey.getLispAddressContainer()));
+        LOG.debug("MD-SAL: Adding authentication key '{}' for {}", authenticationKey.getMappingAuthkey().getKeyString(),
+                LispAddressStringifier.getString(authenticationKey.getEid()));
 
         InstanceIdentifier<AuthenticationKey> path = InstanceIdentifierUtil
-                .createAuthenticationKeyIid(authenticationKey.getLispAddressContainer());
+                .createAuthenticationKeyIid(authenticationKey.getEid());
         writePutTransaction(path, authenticationKey, LogicalDatastoreType.CONFIGURATION,
                 "Adding authentication key to config datastrore failed");
     }
 
     public void addMapping(Mapping mapping) {
         LOG.debug("MD-SAL: Adding mapping for {}",
-                LispAddressStringifier.getString(mapping.getLispAddressContainer()));
+                LispAddressStringifier.getString(mapping.getMappingRecord().getEid()));
 
         InstanceIdentifier<Mapping> path = InstanceIdentifierUtil
-                .createMappingIid(mapping.getLispAddressContainer(), mapping.getOrigin());
+                .createMappingIid(mapping.getMappingRecord().getEid(), mapping.getOrigin());
         writePutTransaction(path, mapping, LogicalDatastoreType.CONFIGURATION,
                 "Adding mapping to config datastrore failed");
     }
 
     public void removeAuthenticationKey(AuthenticationKey authenticationKey) {
         LOG.debug("MD-SAL: Removing authentication key for {}",
-                LispAddressStringifier.getString(authenticationKey.getLispAddressContainer()));
+                LispAddressStringifier.getString(authenticationKey.getEid()));
 
         InstanceIdentifier<AuthenticationKey> path = InstanceIdentifierUtil
-                .createAuthenticationKeyIid(authenticationKey.getLispAddressContainer());
+                .createAuthenticationKeyIid(authenticationKey.getEid());
         deleteTransaction(path, LogicalDatastoreType.CONFIGURATION,
                 "Deleting authentication key from config datastrore failed");
     }
 
     public void removeMapping(Mapping mapping) {
         LOG.debug("MD-SAL: Removing mapping for {}",
-                LispAddressStringifier.getString(mapping.getLispAddressContainer()));
+                LispAddressStringifier.getString(mapping.getMappingRecord().getEid()));
 
         InstanceIdentifier<Mapping> path = InstanceIdentifierUtil
-                .createMappingIid(mapping.getLispAddressContainer(), mapping.getOrigin());
+                .createMappingIid(mapping.getMappingRecord().getEid(), mapping.getOrigin());
         deleteTransaction(path, LogicalDatastoreType.CONFIGURATION, "Deleting mapping from config datastrore failed");
     }
 
@@ -92,21 +92,21 @@ public class DataStoreBackEnd {
 
     public void updateAuthenticationKey(AuthenticationKey authenticationKey) {
         LOG.debug("MD-SAL: Updating authentication key for {} with '{}'",
-                LispAddressStringifier.getString(authenticationKey.getLispAddressContainer()),
-                authenticationKey.getAuthkey());
+                LispAddressStringifier.getString(authenticationKey.getEid()),
+                authenticationKey.getMappingAuthkey().getKeyString());
 
         InstanceIdentifier<AuthenticationKey> path = InstanceIdentifierUtil
-                .createAuthenticationKeyIid(authenticationKey.getLispAddressContainer());
+                .createAuthenticationKeyIid(authenticationKey.getEid());
         writePutTransaction(path, authenticationKey, LogicalDatastoreType.CONFIGURATION,
                 "Updating authentication key in config datastrore failed");
     }
 
     public void updateMapping(Mapping mapping) {
         LOG.debug("MD-SAL: Updating mapping for {}",
-                LispAddressStringifier.getString(mapping.getLispAddressContainer()));
+                LispAddressStringifier.getString(mapping.getMappingRecord().getEid()));
 
         InstanceIdentifier<Mapping> path = InstanceIdentifierUtil
-                .createMappingIid(mapping.getLispAddressContainer(), mapping.getOrigin());
+                .createMappingIid(mapping.getMappingRecord().getEid(), mapping.getOrigin());
         writePutTransaction(path, mapping, LogicalDatastoreType.CONFIGURATION,
                 "Updating mapping in config datastrore failed");
     }
@@ -118,7 +118,7 @@ public class DataStoreBackEnd {
         MappingDatabase mdb = readTransaction(path, LogicalDatastoreType.CONFIGURATION);
 
         if (mdb != null) {
-            for (InstanceId id : mdb.getInstanceId()) {
+            for (VirtualNetworkIdentifier id : mdb.getVirtualNetworkIdentifier()) {
                 List<Mapping> ms = id.getMapping();
                 if (ms != null) {
                     mappings.addAll(ms);
@@ -136,7 +136,7 @@ public class DataStoreBackEnd {
         MappingDatabase mdb = readTransaction(path, LogicalDatastoreType.CONFIGURATION);
 
         if (mdb != null) {
-            for (InstanceId id : mdb.getInstanceId()) {
+            for (VirtualNetworkIdentifier id : mdb.getVirtualNetworkIdentifier()) {
                 List<AuthenticationKey> keys = id.getAuthenticationKey();
                 if (keys != null) {
                     authKeys.addAll(keys);