def __init__(self, bigip, partition, user_agent=None, prefix=None, schema_path=None): """Initialize an instance of the F5 CCCL service manager. :param bigip: BIG-IP management root. :param partition: Name of BIG-IP partition to manage. :param user_agent: String to append to the User-Agent header for iControl REST requests (default: None) :param prefix: The prefix assigned to resources that should be managed by this CCCL instance. This is prepended to the resource name (default: None) :param schema_path: User defined schema (default: from package) """ LOGGER.debug("F5CloudServiceManager initialize") # Set user-agent for ICR session if user_agent is not None: bigip.icrs.append_user_agent(user_agent) self._user_agent = user_agent self._bigip_proxy = BigIPProxy(bigip, partition, prefix=prefix) if schema_path is None: schema_path = pkg_resources.resource_filename(resource_package, ltm_api_schema) self._service_manager = ServiceManager(self._bigip_proxy, partition, schema_path)
def service_manager(): partition = "test" schema = 'f5_cccl/schemas/cccl-api-schema.yml' service_mgr = ServiceManager(bigip_proxy(), partition, schema) return service_mgr
def __init__(self, bigip, partition, prefix=None, schema_path=None): """Initialize an instance of the F5 CCCL service manager. :param bigip: BIG-IP management root. :param partition: Name of BIG-IP partition to manage. :param prefix: The prefix assigned to resources that should be managed by this CCCL instance. This is prepended to the resource name (default: None) :param schema_path: User defined schema (default: from package) """ LOGGER.debug("F5CloudServiceManager initialize") self._bigip_proxy = BigIPProxy(bigip, partition, prefix=prefix) if schema_path is None: schema_path = pkg_resources.resource_filename( resource_package, api_schema) self._service_manager = ServiceManager(self._bigip_proxy, partition, schema_path)
def __init__(self, hostname, username, password, partition, prefix=None, port=443, token=None, schema_path=API_SCHEMA): """Initialize an instance of the F5 CCCL service manager. :param hostname: BIG-IP hostname or ip address. :param username: Access BIG-IP as user :param password: User password :param partition: Name of BIG-IP partition to manage. :param prefix: Optional string to prepend to resource names (default: None). :param port: Port to use for connection (default: 443) :param token: Use for token authentication (default None) """ self._bigip = CommonBigIP(hostname, username, password, partition, prefix=prefix, port=port, token=token) self._service_manager = ServiceManager(self._bigip, partition, schema_path, prefix)
def ltm_service_manager(bigip_proxy, partition): schema = 'f5_cccl/schemas/cccl-ltm-api-schema.yml' service_mgr = ServiceManager(bigip_proxy, partition, schema) return service_mgr
class F5CloudServiceManager(object): """F5 Common Controller Cloud Service Management. The F5 Common Controller Core Library (CCCL) is an orchestration package that provides a declarative API for defining BIG-IP LTM services in diverse environments (e.g. Marathon, Kubernetes, OpenStack). The API will allow a user to create proxy services by specifying the: virtual servers, pools, L7 policy and rules, and monitors as a service description object. Each instance of the CCCL is initialized with namespace qualifiers to allow it to uniquely identify the resources under its control. """ def __init__(self, hostname, username, password, partition, prefix=None, port=443, token=None, schema_path=API_SCHEMA): """Initialize an instance of the F5 CCCL service manager. :param hostname: BIG-IP hostname or ip address. :param username: Access BIG-IP as user :param password: User password :param partition: Name of BIG-IP partition to manage. :param prefix: Optional string to prepend to resource names (default: None). :param port: Port to use for connection (default: 443) :param token: Use for token authentication (default None) """ self._bigip = CommonBigIP(hostname, username, password, partition, prefix=prefix, port=port, token=token) self._service_manager = ServiceManager(self._bigip, partition, schema_path, prefix) def apply_config(self, services): """Apply service configurations to the BIG-IP partition. :param services: A serializable object that defines one or more services. Its schema is defined by cccl-api-schema.json. :return: True if successful, otherwise an exception is thrown. """ return self._service_manager.apply_config(services) def get_partition(self): """Get the name of the managed partition. :return: The managed partition name. """ return self._service_manager.get_partition() def get_status(self): """Get status for each service in the managed partition. :return: A serializable object of the statuses of each managed resource. Its structure is defined by: cccl-status-schema.json """ status = {} return status def get_statistics(self): """Get statistics for each service in the managed partition. :return: A serializable object of the virtual server statistics for each service. Its structure is defined by: cccl-statistics-schema.json """ statistics = {} return statistics
class F5CloudServiceManager(object): """F5 Common Controller Cloud Service Management. The F5 Common Controller Core Library (CCCL) is an orchestration package that provides a declarative API for defining BIG-IP LTM and NET services in diverse environments (e.g. Marathon, Kubernetes, OpenStack). The API will allow a user to create proxy services by specifying the: virtual servers, pools, L7 policy and rules, monitors, arps, or fdbTunnels as a service description object. Each instance of the CCCL is initialized with namespace qualifiers to allow it to uniquely identify the resources under its control. """ def __init__(self, bigip, partition, user_agent=None, prefix=None, schema_path=None): """Initialize an instance of the F5 CCCL service manager. :param bigip: BIG-IP management root. :param partition: Name of BIG-IP partition to manage. :param user_agent: String to append to the User-Agent header for iControl REST requests (default: None) :param prefix: The prefix assigned to resources that should be managed by this CCCL instance. This is prepended to the resource name (default: None) :param schema_path: User defined schema (default: from package) """ LOGGER.debug("F5CloudServiceManager initialize") # Set user-agent for ICR session if user_agent is not None: bigip.icrs.append_user_agent(user_agent) self._user_agent = user_agent self._bigip_proxy = BigIPProxy(bigip, partition, prefix=prefix) if schema_path is None: schema_path = pkg_resources.resource_filename(resource_package, ltm_api_schema) self._service_manager = ServiceManager(self._bigip_proxy, partition, schema_path) def apply_ltm_config(self, services): """Apply LTM service configurations to the BIG-IP partition. :param services: A serializable object that defines one or more services. Its schema is defined by cccl-ltm-api-schema.json. :return: True if successful, otherwise an exception is thrown. """ return self._service_manager.apply_ltm_config(services, self._user_agent) def apply_net_config(self, services): """Apply NET service configurations to the BIG-IP partition. :param services: A serializable object that defines one or more services. Its schema is defined by cccl-net-api-schema.json. :return: True if successful, otherwise an exception is thrown. """ return self._service_manager.apply_net_config(services) def get_partition(self): """Get the name of the managed partition. :return: The managed partition name. """ return self._service_manager.get_partition() def get_status(self): """Get status for each service in the managed partition. :return: A serializable object of the statuses of each managed resource. Its structure is defined by: cccl-status-schema.json """ status = {} return status def get_statistics(self): """Get statistics for each service in the managed partition. :return: A serializable object of the virtual server statistics for each service. Its structure is defined by: cccl-statistics-schema.json """ statistics = {} return statistics
class F5CloudServiceManager(object): """F5 Common Controller Cloud Service Management. The F5 Common Controller Core Library (CCCL) is an orchestration package that provides a declarative API for defining BIG-IP LTM and NET services in diverse environments (e.g. Marathon, Kubernetes, OpenStack). The API will allow a user to create proxy services by specifying the: virtual servers, pools, L7 policy and rules, monitors, arps, or fdbTunnels as a service description object. Each instance of the CCCL is initialized with namespace qualifiers to allow it to uniquely identify the resources under its control. """ def __init__(self, bigip, partition, user_agent=None, prefix=None, schema_path=None): """Initialize an instance of the F5 CCCL service manager. :param bigip: BIG-IP management root. :param partition: Name of BIG-IP partition to manage. :param user_agent: String to append to the User-Agent header for iControl REST requests (default: None) :param prefix: The prefix assigned to resources that should be managed by this CCCL instance. This is prepended to the resource name (default: None) :param schema_path: User defined schema (default: from package) """ LOGGER.debug("F5CloudServiceManager initialize") # Set user-agent for ICR session if user_agent is not None: bigip.icrs.append_user_agent(user_agent) self._user_agent = user_agent self._bigip_proxy = BigIPProxy(bigip, partition, prefix=prefix) if schema_path is None: schema_path = pkg_resources.resource_filename(resource_package, ltm_api_schema) self._service_manager = ServiceManager(self._bigip_proxy, partition, schema_path) def get_proxy(self): """Return the BigIP proxy""" # This is only needed until delete_unused_ssl_profiles is properly # integrated into apply_ltm_config return self._bigip_proxy def apply_ltm_config(self, services): """Apply LTM service configurations to the BIG-IP partition. :param services: A serializable object that defines one or more services. Its schema is defined by cccl-ltm-api-schema.json. :return: True if successful, otherwise an exception is thrown. """ return self._service_manager.apply_ltm_config(services, self._user_agent) def apply_net_config(self, services): """Apply NET service configurations to the BIG-IP partition. :param services: A serializable object that defines one or more services. Its schema is defined by cccl-net-api-schema.json. :return: True if successful, otherwise an exception is thrown. """ return self._service_manager.apply_net_config(services) def get_partition(self): """Get the name of the managed partition. :return: The managed partition name. """ return self._service_manager.get_partition() def get_status(self): """Get status for each service in the managed partition. :return: A serializable object of the statuses of each managed resource. Its structure is defined by: cccl-status-schema.json """ status = {} return status def get_statistics(self): """Get statistics for each service in the managed partition. :return: A serializable object of the virtual server statistics for each service. Its structure is defined by: cccl-statistics-schema.json """ statistics = {} return statistics