sonata-nfv / son-gkeeper

SONATA's Service Platform Gatekeeper
http://www.sonata-nfv.eu
Apache License 2.0
2 stars 18 forks source link

Fix private service without user licence field #879

Closed jbonnet closed 7 years ago

jbonnet commented 7 years ago

The GK is sending the private service with no user_licence field so BSS thinks that is public.

jbonnet commented 7 years ago

Hi, @srodriguezOPT I can't reproduce the problem. See below: the second service is private (user sonata), so it gets the "user_licence"="owned". Isn't this correct?

[
    {
        "created_at": "2017-09-15T01:48:19.975+00:00", 
        "md5": "c9325752fae5d79e9c417bf80d8a4914", 
        "nsd": {
            "author": "Steven Van Rossem, Ghent University", 
            "connection_points": [
                {
                    "id": "mgmt", 
                    "interface": "ipv4", 
                    "type": "management"
                }, 
                {
                    "id": "input", 
                    "interface": "ipv4", 
                    "type": "external"
                }, 
                {
                    "id": "output", 
                    "interface": "ipv4", 
                    "type": "external"
                }
            ], 
            "description": "\"The network service descriptor for the SONATA demo,\n comprising only a Virtual Traffic Classifier\"\n", 
            "descriptor_version": "1.0", 
            "forwarding_graphs": [
                {
                    "constituent_vnfs": [
                        "vnf_vtc"
                    ], 
                    "fg_id": "ns:fg01", 
                    "network_forwarding_paths": [
                        {
                            "connection_points": [
                                {
                                    "connection_point_ref": "input", 
                                    "position": 1
                                }, 
                                {
                                    "connection_point_ref": "vnf_vtc:input", 
                                    "position": 2
                                }, 
                                {
                                    "connection_point_ref": "vnf_vtc:output", 
                                    "position": 3
                                }, 
                                {
                                    "connection_point_ref": "output", 
                                    "position": 4
                                }
                            ], 
                            "fp_id": "ns:fg01:fp01", 
                            "policy": "none"
                        }
                    ], 
                    "number_of_endpoints": 2, 
                    "number_of_virtual_links": 2
                }
            ], 
            "name": "sonata-demo-vtc", 
            "network_functions": [
                {
                    "vnf_id": "vnf_vtc", 
                    "vnf_name": "vtc-vnf", 
                    "vnf_vendor": "eu.sonata-nfv", 
                    "vnf_version": "0.1"
                }
            ], 
            "service_specific_managers": [
                {
                    "description": "An empty example SSM.", 
                    "id": "ssmdumb", 
                    "image": "sonatanfv/ssmdumb", 
                    "options": [
                        {
                            "key": "myKey", 
                            "value": "myValue"
                        }
                    ]
                }
            ], 
            "vendor": "eu.sonata-nfv.service-descriptor", 
            "version": "0.1", 
            "virtual_links": [
                {
                    "connection_points_reference": [
                        "vnf_vtc:mgmt", 
                        "mgmt"
                    ], 
                    "connectivity_type": "E-LAN", 
                    "id": "mgmt"
                }, 
                {
                    "connection_points_reference": [
                        "input", 
                        "vnf_vtc:input"
                    ], 
                    "connectivity_type": "E-Line", 
                    "id": "input-2-vtc"
                }, 
                {
                    "connection_points_reference": [
                        "vnf_vtc:output", 
                        "output"
                    ], 
                    "connectivity_type": "E-Line", 
                    "id": "vtc-2-output"
                }
            ]
        }, 
        "signature": null, 
        "status": "active", 
        "updated_at": "2017-09-15T01:48:19.975+00:00", 
        "user_licence": "public", 
        "username": "jenkins", 
        "uuid": "21fff5fa-5770-4fe7-9e34-a0f60ae63b88"
    }, 
    {
        "created_at": "2017-09-15T09:02:54.348+00:00", 
        "md5": "8f734a052d8dbb405e0fe0badd314e33", 
        "nsd": {
            "author": "Steven Van Rossem, Ghent University", 
            "connection_points": [
                {
                    "id": "mgmt", 
                    "interface": "ipv4", 
                    "type": "management"
                }, 
                {
                    "id": "input", 
                    "interface": "ipv4", 
                    "type": "external"
                }, 
                {
                    "id": "output", 
                    "interface": "ipv4", 
                    "type": "external"
                }
            ], 
            "description": "\"The network service descriptor for the SONATA demo,\n comprising only a Virtual Traffic Classifier. \n This service is defined as private (licence is required)\"\n", 
            "descriptor_version": "1.0", 
            "forwarding_graphs": [
                {
                    "constituent_vnfs": [
                        "vnf_vtc"
                    ], 
                    "fg_id": "ns:fg01", 
                    "network_forwarding_paths": [
                        {
                            "connection_points": [
                                {
                                    "connection_point_ref": "input", 
                                    "position": 1
                                }, 
                                {
                                    "connection_point_ref": "vnf_vtc:input", 
                                    "position": 2
                                }, 
                                {
                                    "connection_point_ref": "vnf_vtc:output", 
                                    "position": 3
                                }, 
                                {
                                    "connection_point_ref": "output", 
                                    "position": 4
                                }
                            ], 
                            "fp_id": "ns:fg01:fp01", 
                            "policy": "none"
                        }
                    ], 
                    "number_of_endpoints": 2, 
                    "number_of_virtual_links": 2
                }
            ], 
            "licences": [
                {
                    "type": "private", 
                    "url": "https://sp.int3.sonata-nfv.eu/api/v2/licences"
                }
            ], 
            "name": "sonata-demo-private-vtc", 
            "network_functions": [
                {
                    "vnf_id": "vnf_vtc", 
                    "vnf_name": "vtc-vnf", 
                    "vnf_vendor": "eu.sonata-nfv", 
                    "vnf_version": "0.1"
                }
            ], 
            "service_specific_managers": [
                {
                    "description": "An empty example SSM.", 
                    "id": "ssmdumb", 
                    "image": "sonatanfv/ssmdumb", 
                    "options": [
                        {
                            "key": "myKey", 
                            "value": "myValue"
                        }
                    ]
                }
            ], 
            "vendor": "eu.sonata-nfv.service-descriptor", 
            "version": "0.1", 
            "virtual_links": [
                {
                    "connection_points_reference": [
                        "vnf_vtc:mgmt", 
                        "mgmt"
                    ], 
                    "connectivity_type": "E-LAN", 
                    "id": "mgmt"
                }, 
                {
                    "connection_points_reference": [
                        "input", 
                        "vnf_vtc:input"
                    ], 
                    "connectivity_type": "E-Line", 
                    "id": "input-2-vtc"
                }, 
                {
                    "connection_points_reference": [
                        "vnf_vtc:output", 
                        "output"
                    ], 
                    "connectivity_type": "E-Line", 
                    "id": "vtc-2-output"
                }
            ]
        }, 
        "signature": null, 
        "status": "active", 
        "updated_at": "2017-09-15T09:02:54.348+00:00", 
        "user_licence": "owned", 
        "username": "sonata", 
        "uuid": "e4dc0b74-7637-4cd6-80bc-2a32fd9ef750"
    }
]
santiagordguez commented 7 years ago

Hi @jbonnet Yes, now seems to be working: image

Can we test the private and no owned case? With this, we could test the licence creation since the BSS.

jbonnet commented 7 years ago

YESS! :-) Of course! Just use other user than sonata or jenkins...

santiagordguez commented 7 years ago

Hi @jbonnet,

I registered a new user "sonata1/sonata1" and the service appeared as "to buy" in terms of the licence. The licence acquisition went well but when the list of available services was refreshed, the service appeared as "Public" with no user_licence field.

jbonnet commented 7 years ago

Hi, @srodriguezOPT Hmm... different problem... let me look

jbonnet commented 7 years ago

Hi, again @srodriguezOPT I think I've fixed the problem. Have you created the licence through the BSS? It is created as PUBLIC, which is not coherent (if the licence_type field is absent, it defaults to PUBLIC). We must make tests with multiple licences for multiple services and one user: I've tested this, but I'm not 100% confident of having covered all the cases