Example #1
0
    def _create(self, service_input):
        """Creates a service object in SDC"""
        service = None

        existing = get_service_id(service_input.get("service_name"))
        if existing is None:
            service = create_service(service_input)
        elif service_input.get("allow_update"):
            service = update_service(existing, service_input)
        else:
            raise exceptions.ResourceAlreadyExistsException(
                "Service resource {} already exists".format(
                    service_input.get("service_name")))

        return service
Example #2
0
    def _create(self, vnf_input):
        """Creates a vnf object in SDC"""
        vnf = None

        existing = get_vnf_id(vnf_input.get("vnf_name"))
        if not existing:
            vnf = create_vnf(vnf_input)
        elif vnf_input.get("allow_update"):
            vnf = update_vnf(existing, vnf_input)
        else:
            raise exceptions.ResourceAlreadyExistsException(
                "VNF resource {} already exists".format(vnf_input.get("vnf_name"))
            )

        return vnf