remove vbng service
diff --git a/xos/api/service/vbng/debug.py b/xos/api/service/vbng/debug.py
deleted file mode 100644
index 8ecec0f..0000000
--- a/xos/api/service/vbng/debug.py
+++ /dev/null
@@ -1,61 +0,0 @@
-from rest_framework.decorators import api_view
-from rest_framework.response import Response
-from rest_framework.reverse import reverse
-from rest_framework import serializers
-from rest_framework import generics
-from rest_framework import viewsets
-from rest_framework.decorators import detail_route, list_route
-from rest_framework.views import APIView
-from core.models import *
-from django.forms import widgets
-from django.conf.urls import patterns, url
-from services.cord.models import VOLTTenant, VBNGTenant, CordSubscriberRoot
-from core.xoslib.objects.cordsubscriber import CordSubscriber
-from api.xosapi_helpers import PlusModelSerializer, XOSViewSet
-from django.shortcuts import get_object_or_404
-from xos.apibase import XOSListCreateAPIView, XOSRetrieveUpdateDestroyAPIView, XOSPermissionDenied
-from xos.exceptions import *
-import json
-import subprocess
-
-if hasattr(serializers, "ReadOnlyField"):
- # rest_framework 3.x
- ReadOnlyField = serializers.ReadOnlyField
-else:
- # rest_framework 2.x
- ReadOnlyField = serializers.Field
-
-class CordDebugIdSerializer(PlusModelSerializer):
- # Swagger is failing because CordDebugViewSet has neither a model nor
- # a serializer_class. Stuck this in here as a placeholder for now.
- id = ReadOnlyField()
- class Meta:
- model = CordSubscriber
-
-class CordDebugViewSet(XOSViewSet):
- base_name = "debug"
- method_name = "debug"
- method_kind = "viewset"
- serializer_class = CordDebugIdSerializer
-
- @classmethod
- def get_urlpatterns(self, api_path="^"):
- patterns = []
- patterns.append( url(api_path + "debug/vbng_dump/$", self.as_view({"get": "get_vbng_dump"}), name="vbng_dump"))
- return patterns
-
- # contact vBNG service and dump current list of mappings
- def get_vbng_dump(self, request, pk=None):
- result=subprocess.check_output(["curl", "http://10.0.3.136:8181/onos/virtualbng/privateip/map"])
- if request.GET.get("theformat",None)=="text":
- from django.http import HttpResponse
- result = json.loads(result)["map"]
-
- lines = []
- for row in result:
- for k in row.keys():
- lines.append( "%s %s" % (k, row[k]) )
-
- return HttpResponse("\n".join(lines), content_type="text/plain")
- else:
- return Response( {"vbng_dump": json.loads(result)["map"] } )
diff --git a/xos/synchronizers/vbng/model-deps b/xos/synchronizers/vbng/model-deps
deleted file mode 100644
index 0967ef4..0000000
--- a/xos/synchronizers/vbng/model-deps
+++ /dev/null
@@ -1 +0,0 @@
-{}
diff --git a/xos/synchronizers/vbng/run.sh b/xos/synchronizers/vbng/run.sh
deleted file mode 100755
index de3ed7c..0000000
--- a/xos/synchronizers/vbng/run.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#if [[ ! -e ./vbng-observer.py ]]; then
-# ln -s ../../xos-observer.py vbng-observer.py
-#fi
-
-export XOS_DIR=/opt/xos
-python vbng-synchronizer.py -C $XOS_DIR/synchronizers/vbng/vbng_synchronizer_config
diff --git a/xos/synchronizers/vbng/start.sh b/xos/synchronizers/vbng/start.sh
deleted file mode 100755
index 9553610..0000000
--- a/xos/synchronizers/vbng/start.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#if [[ ! -e ./vbng-observer.py ]]; then
-# ln -s ../../xos-observer.py vbng-observer.py
-#fi
-
-export XOS_DIR=/opt/xos
-nohup python vbng-synchronizer.py -C $XOS_DIR/synchronizers/vbng/vbng_synchronizer_config > /dev/null 2>&1 &
diff --git a/xos/synchronizers/vbng/steps/sync_vbngtenant.py b/xos/synchronizers/vbng/steps/sync_vbngtenant.py
deleted file mode 100644
index 89e7bc0..0000000
--- a/xos/synchronizers/vbng/steps/sync_vbngtenant.py
+++ /dev/null
@@ -1,142 +0,0 @@
-import os
-import requests
-import socket
-import sys
-import base64
-from django.db.models import F, Q
-from xos.config import Config
-from synchronizers.base.syncstep import SyncStep
-from synchronizers.base.ansible import run_template_ssh
-from core.models import Service
-from services.cord.models import VSGService, VSGTenant, VBNGTenant, VBNGService
-from services.hpc.models import HpcService, CDNPrefix
-from xos.logger import Logger, logging
-
-# VBNG_API = "http://10.0.3.136:8181/onos/virtualbng/privateip/"
-
-# hpclibrary will be in steps/..
-parentdir = os.path.join(os.path.dirname(__file__),"..")
-sys.path.insert(0,parentdir)
-
-logger = Logger(level=logging.INFO)
-
-class SyncVBNGTenant(SyncStep):
- provides=[VSGTenant]
- observes=VSGTenant
- requested_interval=0
-
- def __init__(self, **args):
- SyncStep.__init__(self, **args)
-
- def fetch_pending(self, deleted):
- if (not deleted):
- objs = VBNGTenant.get_tenant_objects().filter(Q(enacted__lt=F('updated')) | Q(enacted=None),Q(lazy_blocked=False))
- else:
- objs = VBNGTenant.get_deleted_tenant_objects()
-
- return objs
-
- def defer_sync(self, o, reason):
- logger.info("defer object %s due to %s" % (str(o), reason),extra=o.tologdict())
- raise Exception("defer object %s due to %s" % (str(o), reason))
-
- def get_vbng_service(self, o):
- if not o.provider_service:
- raise Exception("vBNG tenant %s has no provider_service" % str(o.id))
- services = VBNGService.get_service_objects().filter(id = o.provider_service.id)
- if not services:
- raise Exception("vBNG tenant %s is associated with the wrong kind of provider_service" % str(o.id))
- return services[0]
-
- def get_vbng_url(self, o):
- service = self.get_vbng_service(o)
-
- # if the service object specifies a vbng_url, then use it
- if service.vbng_url:
- return service.vbng_url
-
- # otherwise, see if the service has tenancy in ONOS
- for tenant in service.subscribed_tenants.all():
- if tenant.provider_service and tenant.provider_service.kind == "onos":
- onos_service = tenant.provider_service
- if not onos_service.slices.exists():
- raise Exception("vBNG service is linked to an ONOSApp, but the App's Service has no slices")
- onos_slice = onos_service.slices.all()[0]
- if not onos_slice.instances.exists():
- raise Exception("vBNG service is linked to an ONOSApp, but the App's Service's Slice has no instances")
- instance = onos_slice.instances.all()[0]
-
- #onos_app = ONOSApp.objects.filter(id = tenant.id)
- #instance = onos_app.instance
- #if not instance:
- # raise Exception("ONOSApp has no instance")
-
- if not instance.instance_name:
- raise Exception("vBNG service is linked to an ONOSApp, but the App's Service's Slice's first instance is not instantiated")
- ip = instance.get_network_ip("nat")
- if not ip:
- raise Exception("vBNG service is linked to an ONOSApp, but the App's Service's Slice's first instance does not have an ip")
-
- logger.info("Using ip %s from ONOS Instance %s" % (ip, instance),extra=o.tologdict())
-
- return "http://%s:8181/onos/virtualbng/" % ip
-
- raise Exception("vBNG service does not have vbng_url set, and is not linked to an ONOSApp")
-
- def get_private_interface(self, o):
- vcpes = VSGTenant.get_tenant_objects().all()
- vcpes = [x for x in vcpes if (x.vbng is not None) and (x.vbng.id == o.id)]
- if not vcpes:
- raise Exception("No vCPE tenant is associated with vBNG %s" % str(o.id))
- if len(vcpes)>1:
- raise Exception("More than one vCPE tenant is associated with vBNG %s" % str(o.id))
-
- vcpe = vcpes[0]
- instance = vcpe.instance
-
- if not instance:
- raise Exception("No instance associated with vBNG %s" % str(o.id))
-
- if not vcpe.wan_ip:
- self.defer_sync(o, "does not have a WAN IP yet")
-
- if not vcpe.wan_container_mac:
- # this should never happen; container MAC is computed from WAN IP
- self.defer_sync(o, "does not have a WAN container MAC yet")
-
- return (vcpe.wan_ip, vcpe.wan_container_mac, vcpe.instance.node.name)
-
- def sync_record(self, o):
- logger.info("sync'ing VBNGTenant %s" % str(o),extra=o.tologdict())
-
- if not o.routeable_subnet:
- (private_ip, private_mac, private_hostname) = self.get_private_interface(o)
- logger.info("contacting vBNG service to request mapping for private ip %s mac %s host %s" % (private_ip, private_mac, private_hostname) ,extra=o.tologdict())
-
- url = self.get_vbng_url(o) + "privateip/%s/%s/%s" % (private_ip, private_mac, private_hostname)
- logger.info( "vbng url: %s" % url ,extra=o.tologdict())
- r = requests.post(url )
- if (r.status_code != 200):
- raise Exception("Received error from bng service (%d)" % r.status_code)
- logger.info("received public IP %s from private IP %s" % (r.text, private_ip),extra=o.tologdict())
-
- if r.text == "0":
- raise Exception("VBNG service failed to return a routeable_subnet (probably ran out)")
-
- o.routeable_subnet = r.text
- o.mapped_ip = private_ip
- o.mapped_mac = private_mac
- o.mapped_hostname = private_hostname
-
- o.save()
-
- def delete_record(self, o):
- logger.info("deleting VBNGTenant %s" % str(o),extra=o.tologdict())
-
- if o.mapped_ip:
- private_ip = o.mapped_ip
- logger.info("contacting vBNG service to delete private ip %s" % private_ip,extra=o.tologdict())
- r = requests.delete(self.get_vbng_url(o) + "privateip/%s" % private_ip, )
- if (r.status_code != 200):
- raise Exception("Received error from bng service (%d)" % r.status_code)
-
diff --git a/xos/synchronizers/vbng/stop.sh b/xos/synchronizers/vbng/stop.sh
deleted file mode 100755
index d49591e..0000000
--- a/xos/synchronizers/vbng/stop.sh
+++ /dev/null
@@ -1 +0,0 @@
-pkill -9 -f vbng-observer.py
diff --git a/xos/synchronizers/vbng/supervisor/vbng-observer.conf b/xos/synchronizers/vbng/supervisor/vbng-observer.conf
deleted file mode 100644
index a999318..0000000
--- a/xos/synchronizers/vbng/supervisor/vbng-observer.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-[program:vbng-observer]
-command=python /opt/xos/synchronizers/vbng/vbng-synchronizer.py -C /opt/xos/synchronizers/vbng/vbng_synchronizer_config
diff --git a/xos/synchronizers/vbng/vbng-synchronizer.py b/xos/synchronizers/vbng/vbng-synchronizer.py
deleted file mode 100755
index 84bec4f..0000000
--- a/xos/synchronizers/vbng/vbng-synchronizer.py
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env python
-
-# This imports and runs ../../xos-observer.py
-
-import importlib
-import os
-import sys
-observer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),"../../synchronizers/base")
-sys.path.append(observer_path)
-mod = importlib.import_module("xos-synchronizer")
-mod.main()
diff --git a/xos/synchronizers/vbng/vbng_synchronizer_config b/xos/synchronizers/vbng/vbng_synchronizer_config
deleted file mode 100644
index d613ce3..0000000
--- a/xos/synchronizers/vbng/vbng_synchronizer_config
+++ /dev/null
@@ -1,38 +0,0 @@
-
-[plc]
-name=plc
-deployment=VICCI
-
-[db]
-name=xos
-user=postgres
-password=password
-host=localhost
-port=5432
-
-[api]
-host=128.112.171.237
-port=8000
-ssl_key=None
-ssl_cert=None
-ca_ssl_cert=None
-ratelimit_enabled=0
-omf_enabled=0
-mail_support_address=support@localhost
-nova_enabled=True
-
-[observer]
-name=vbng
-dependency_graph=/opt/xos/synchronizers/vbng/model-deps
-steps_dir=/opt/xos/synchronizers/vbng/steps
-sys_dir=/opt/xos/synchronizers/vbng/sys
-deleters_dir=/opt/xos/synchronizers/vbng/deleters
-log_file=console
-#/var/log/hpc.log
-driver=None
-pretend=False
-backoff_disabled=True
-
-[feefie]
-client_id='vicci_dev_central'
-user_id='pl'
diff --git a/xos/tosca/resources/vbngservice.py b/xos/tosca/resources/vbngservice.py
deleted file mode 100644
index 28d4a1d..0000000
--- a/xos/tosca/resources/vbngservice.py
+++ /dev/null
@@ -1,16 +0,0 @@
-import os
-import pdb
-import sys
-import tempfile
-sys.path.append("/opt/tosca")
-from translator.toscalib.tosca_template import ToscaTemplate
-
-from services.cord.models import VBNGService
-
-from service import XOSService
-
-class XOSVBGNService(XOSService):
- provides = "tosca.nodes.VBNGService"
- xos_model = VBNGService
- copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "versionNumber", "vbng_url"]
-