[gerrit]
host=gerrit.onap.org
port=29418
-project=vfc/gvnfm/vnfmgr
\ No newline at end of file
+project=vfc/gvnfm/vnfmgr
# 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.
+
pip install -r requirements.txt
# 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.
-import os
# [MSB]
MSB_SERVICE_IP = '127.0.0.1'
# 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.
+
from django.db import models
port = models.CharField(db_column='PORT', max_length=200)
username = models.CharField(db_column='USERNAME', max_length=255)
password = models.CharField(db_column='PASSWORD', max_length=255)
-
-
self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
resp_data = json.loads(response.content)
self.assertEqual({"status": "active"}, resp_data)
-
- def test_url(self):
- pass
class SampleList(APIView):
- """
- List all samples.
- """
def get(self, request, format=None):
logger.debug("get")
return Response({"status": "active"})
# limitations under the License.
import unittest
-import json
+
from django.test import Client
from rest_framework import status
def test_sample(self):
response = self.client.get("/api/vnfmgr/v1/swagger.json")
self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
-
from mgr.swagger import views
urlpatterns = [
- url(r'^api/vnfmgr/v1/swagger.json$', views.SwaggerView.as_view()),
+ url(r'^api/vnfmgr/v1/swagger.json$', views.SwaggerView.as_view())
]
# 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.
+
import os
import json
from rest_framework.views import APIView
class SwaggerView(APIView):
- """
- Show rest api swagger.
- """
def get(self, request, format=None):
json_file = os.path.join(os.path.dirname(__file__), 'swagger.json')
f = open(json_file)
]
urlpatterns = format_suffix_patterns(urlpatterns)
-
logger = logging.getLogger(__name__)
+
@api_view(http_method_names=['POST'])
def add_vnf(request, *args, **kwargs):
logger.info("Enter %s, data is %s", fun_name(), request.data)
vnf_inst_id = ignore_case_get(kwargs, "vnfInstId")
logger.info("Enter %s, method is %s, ", fun_name(), request.method)
logger.info("vnfInstId is %s, data is %s", vnf_inst_id, request.data)
- ret, normal_status = None, None
+ # ret, normal_status = None, None
try:
vnf = VnfRegModel.objects.filter(id=vnf_inst_id)
if not vnf:
return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
return Response(data=ret, status=normal_status)
+
@api_view(http_method_names=['POST'])
def vnf_config(request, *args, **kwargs):
logger.info("Enter %s, data is %s", fun_name(), request.data)
except Exception as e:
return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
return Response(data={}, status=status.HTTP_202_ACCEPTED)
-
\ No newline at end of file
# See the License for the specific language governing permissions and
# limitations under the License.
-
import os
from django.core.wsgi import get_wsgi_application