示例#1
0
    def __init__(self, base_kit, apis_to_instantiate):
        """Initialize Operations Handler class."""
        ApiTargetTools.__init__(self, base_kit)

        # Declare the dict that will hold the ApiHandlers.
        self.handler = self.dot_dict()

        # Assign the pertinent config changes (white/black lists).
        self.ops_list_changers = self.dot_dict({
            'whitelist':
            self.conf_dict['config']['whiteList']['value'],
            'blacklist':
            self.conf_dict['config']['blackList']['value']
        })

        # Declare the lists that will hold all ops and filtered ops.
        self.ops = []
        self.raw_ops = []

        # Declare req dictionary for requests received.
        self.req = None

        # Assign the Api versions (list) to be instantiated with handlers.
        self.apis_to_instantiate = apis_to_instantiate
        self.instantiated_api_versions = []

        # Perform the instantiation.
        self._instantiate_api_handlers()

        # Perform rbkcli meta instantiation.
        self._instantiate_rbkcli_handler()
示例#2
0
 def __init__(self, json_data, fields_model, operations, base_kit, req=''):
     ApiTargetTools.__init__(self, base_kit)
     self.operations = operations
     self.json_data = json_data
     self.fields_model = fields_model
     self.base_kit = base_kit
     self.req = req
示例#3
0
 def __init__(self, operations, base_kit):
     """Initialize callback class."""
     ApiTargetTools.__init__(self, base_kit)
     self.operations = operations
     self.base_kit = base_kit
     self.validator = InputHandler(self.base_kit, self.operations)
     self.formatter = OutputHandler(base_kit, self.operations)
示例#4
0
    def __init__(self, base_kit, operations):
        """Initialize InputHandler class."""
        ApiTargetTools.__init__(self, base_kit)

        self.req = self.dot_dict()
        self.req_ops = self.dot_dict()
        self.operations = operations
        self.error = ''
示例#5
0
 def __init__(self, base_kit, operations):
     """Initialize InputHandler class."""
     ApiTargetTools.__init__(self, base_kit)
     self.operations = operations
     self.req = self.dot_dict()
     self.result = self.dot_dict()
     self.result.text = ''
     self.json_iter = self.dot_dict()
示例#6
0
    def __init__(self, user_profile, base_kit, version):
        """Initialize API handler."""
        ApiTargetTools.__init__(self, base_kit)
        self.user_profile = user_profile
        self.base_kit = base_kit
        self.version = version
        self.filter_lists = {}

        self.focus_list = []
        self.all_ops = []
        self.all_apis = {}
        self.meta_api = self.dot_dict()
        # Define the path to search.
        self.scripts_folder = CONSTANTS.BASE_FOLDER + '/scripts'
示例#7
0
    def __init__(self, user_profile, base_kit):
        """Initialize Meta commands class."""
        ApiTargetTools.__init__(self, base_kit)

        self.user_profile = user_profile
        self.version = 'rbkcli'
        self.filter_lists = {}

        self.focus_list = []
        self.all_ops = []
        self.all_apis = {}

        self.meta_api = self.dot_dict()

        self._gen_docs()
        self._gen_exec_dict()
        self._gen_exec_api()
示例#8
0
    def __init__(self, base_kit):
        """Initialize EnvironmentHandler class."""
        ApiTargetTools.__init__(self, base_kit)

        # Result of loading the environment.
        self.env = self.dot_dict()
        self.env.file_name = 'me.json'

        # Dictionary of loading resolution file.
        self.resolution = self.dot_dict()
        self.resolution.file_name = 'target_resolution.json'
        self.resolution.file_path = str(CONSTANTS.CONF_FOLDER + '/' +
                                        self.resolution.file_name)

        # Dictionary that stores what to run to get target ID, environment ID,
        # target version and other targets accepted in this environment.
        self.discovery = self.dot_dict()
        self.discovery.expect_keys = ['id', 'ip', 'envId', 'envName']
        self.discovery.action = self.discover_fn
        self.operations = None