Esempio n. 1
0
    def run(self, tmp=None, task_vars=None):
        self._task.diff = False
        self._result = super(ActionModule, self).run(tmp, task_vars)
        self._result["changed"] = False
        self._check_argspec()

        self._result.update(dict(dnac_response={}))

        dnac = DNACSDK(params=self._task.args)

        id = self._task.args.get("serialNumber")
        if id:
            response = dnac.exec(
                family="devices",
                function='get_device_by_serial_number',
                params=self.get_object(self._task.args)
            )
            self._result.update(dict(dnac_response=response))
            self._result.update(dnac.exit_json())
            return self._result
        if not id:
            # NOTICE: Does not have a get all method or it is in another action
            response = None
            dnac.object_modify_result(changed=False, result="Module does not have get all, check arguments of module")
            self._result.update(dict(dnac_response=response))
            self._result.update(dnac.exit_json())
            return self._result
Esempio n. 2
0
    def run(self, tmp=None, task_vars=None):
        self._task.diff = False
        self._result = super(ActionModule, self).run(tmp, task_vars)
        self._result["changed"] = False
        self._check_argspec()

        self._result.update(dict(dnac_response={}))

        dnac = DNACSDK(params=self._task.args)

        name = self._task.args.get("nameSpace")
        if name:
            response = dnac.exec(family="file",
                                 function='get_list_of_files',
                                 params=self.get_object(self._task.args))
            self._result.update(dict(dnac_response=response))
            self._result.update(dnac.exit_json())
            return self._result
        if not name:
            # NOTICE: Does not have a get all method or it is in another action
            response = None
            dnac.object_modify_result(
                changed=False,
                result="Module does not have get all, check arguments of module"
            )
            self._result.update(dict(dnac_response=response))
            self._result.update(dnac.exit_json())
            return self._result
    def run(self, tmp=None, task_vars=None):
        self._task.diff = False
        self._result = super(ActionModule, self).run(tmp, task_vars)
        self._result["changed"] = False
        self._check_argspec()

        self._result.update(dict(dnac_response={}))

        dnac = DNACSDK(params=self._task.args)

        id = self._task.args.get("fileId")
        if id:
            download_response = dnac.exec(
                family="file",
                function='download_a_file_by_fileid',
                params=self.get_object(self._task.args)
            )
            response = dict(
                data=download_response.data.decode(encoding='utf-8'),
                filename=download_response.filename,
                dirpath=download_response.dirpath,
                path=download_response.path,
            )
            self._result.update(dict(dnac_response=response))
            self._result.update(dnac.exit_json())
            return self._result
        if not id:
            # NOTICE: Does not have a get all method or it is in another action
            response = None
            dnac.object_modify_result(changed=False, result="Module does not have get all, check arguments of module")
            self._result.update(dict(dnac_response=response))
            self._result.update(dnac.exit_json())
            return self._result
Esempio n. 4
0
    def run(self, tmp=None, task_vars=None):
        self._task.diff = False
        self._result = super(ActionModule, self).run(tmp, task_vars)
        self._result["changed"] = False
        self._check_argspec()

        self._result.update(dict(dnac_response={}))

        dnac = DNACSDK(params=self._task.args)

        id = self._task.args.get("siteId")
        if id:
            response = dnac.exec(
                family="software_image_management_swim",
                function='get_golden_tag_status_of_an_image',
                params=self.get_object(self._task.args)
            )
            self._result.update(dict(dnac_response=response))
            self._result.update(dnac.exit_json())
            return self._result
        if not id:
            # NOTICE: Does not have a get all method or it is in another action
            response = None
            dnac.object_modify_result(changed=False, result="Module does not have get all, check arguments of module")
            self._result.update(dict(dnac_response=response))
            self._result.update(dnac.exit_json())
            return self._result
Esempio n. 5
0
    def run(self, tmp=None, task_vars=None):
        self._task.diff = False
        self._result = super(ActionModule, self).run(tmp, task_vars)
        self._result["changed"] = False
        self._check_argspec()

        self._result.update(dict(dnac_response={}))

        dnac = DNACSDK(params=self._task.args)

        id = self._task.args.get("viewGroupId")
        if id:
            response = dnac.exec(
                family="reports",
                function='get_view_details_for_a_given_view_group_and_view',
                params=self.get_object(self._task.args))
            self._result.update(dict(dnac_response=response))
            self._result.update(dnac.exit_json())
            return self._result
        if not id:
            # NOTICE: Does not have a get all method or it is in another action
            response = None
            dnac.object_modify_result(
                changed=False,
                result="Module does not have get all, check arguments of module"
            )
            self._result.update(dict(dnac_response=response))
            self._result.update(dnac.exit_json())
            return self._result