Initial commit of PassiveTest

Change-Id: Idcd9a0c72df5eae6b4eedc544e473ebc9763ccdb
diff --git a/xos/api/service/passivetest.py b/xos/api/service/passivetest.py
new file mode 100644
index 0000000..f5b556d
--- /dev/null
+++ b/xos/api/service/passivetest.py
@@ -0,0 +1,38 @@
+from rest_framework.response import Response
+from rest_framework import serializers
+from api.xosapi_helpers import PlusModelSerializer, XOSViewSet, ReadOnlyField
+from services.passivetest.models import PassiveTestService
+
+class PassiveTestSerializer(PlusModelSerializer):
+    id = ReadOnlyField()
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+    tap_ports = serializers.CharField(required=False)
+    reset_viv = serializers.BooleanField(required=False)
+
+    class Meta:
+        model = PassiveTestService
+        fields = ('humanReadableName',
+                  'id',
+                  'tap_ports',
+                  'reset_viv')
+
+    def getHumanReadableName(self, obj):
+        return obj.__unicode__()
+
+class PassiveTestViewSet(XOSViewSet):
+    base_name = "passivetest"
+    method_name = "passivetest"
+    method_kind = "viewset"
+    queryset = PassiveTestService.get_service_objects().all()
+    serializer_class = PassiveTestSerializer
+
+    @classmethod
+    def get_urlpatterns(self, api_path="^"):
+        patterns = super(PassiveTestViewSet, self).get_urlpatterns(api_path=api_path)
+        return patterns
+
+    def list(self, request):
+        object_list = self.filter_queryset(self.get_queryset())
+        serializer = self.get_serializer(object_list, many=True)
+        return Response(serializer.data)
+