[SEBA-992] Retrieve old s_tag for BNGPortMapping

Change-Id: I44fe8e7e0c818259e863915627bfa6244aff4469
diff --git a/VERSION b/VERSION
index 227cea2..38f77a6 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.0.0
+2.0.1
diff --git a/xos/synchronizer/migrations/0005_bngportmapping_decl_old_s_tag.py b/xos/synchronizer/migrations/0005_bngportmapping_decl_old_s_tag.py
new file mode 100644
index 0000000..fde86af
--- /dev/null
+++ b/xos/synchronizer/migrations/0005_bngportmapping_decl_old_s_tag.py
@@ -0,0 +1,34 @@
+# 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.
+
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.29 on 2020-06-17 16:16
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('fabric-crossconnect', '0004_auto_20190409_1839'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='bngportmapping_decl',
+            name='old_s_tag',
+            field=models.CharField(blank=True, help_text=b'Field for tracking old s-tag of bngportmapping instance', max_length=1024, null=True),
+        ),
+    ]
diff --git a/xos/synchronizer/models/fabric-crossconnect.xproto b/xos/synchronizer/models/fabric-crossconnect.xproto
index 18f0a26..5844106 100644
--- a/xos/synchronizer/models/fabric-crossconnect.xproto
+++ b/xos/synchronizer/models/fabric-crossconnect.xproto
@@ -32,4 +32,7 @@
         unique = True];
     required int32 switch_port = 2 [
         help_text = "Switch port where BNG or other egress point is connected"];
+    optional string old_s_tag = 3 [
+        help_text = "Field for tracking old s-tag of bngportmapping instance",
+        max_length = 1024];
 }
diff --git a/xos/synchronizer/models/models.py b/xos/synchronizer/models/models.py
index 13b56ed..d727ea0 100644
--- a/xos/synchronizer/models/models.py
+++ b/xos/synchronizer/models/models.py
@@ -51,5 +51,12 @@
 
     def save(self, *args, **kwargs):
         self.validate_range(self.s_tag)
+        #Retrieving old_s_tag when s_tag is changed for a BNG instance.
+        old_bng = BNGPortMapping.objects.filter(id=self.id)
+        if(len(old_bng) > 0):
+            if (old_bng[0].s_tag != self.s_tag):
+                self.old_s_tag = old_bng[0].s_tag
+        else:
+            pass
 
         super(BNGPortMapping, self).save(*args, **kwargs)