def get_object_by_name(self, name):
     result = None
     # NOTICE: Does not have a get by name method or it is in another action
     try:
         items = self.dnac.exec(
             family="wireless",
             function="get_enterprise_ssid",
             params=self.get_all_params(name=name),
         )
         if isinstance(items, list):
             for item in items:
                 if isinstance(item, dict):
                     n_item = None
                     if 'response' in item:
                         n_item = item.get('response')
                     if 'ssidDetails' in item:
                         n_item = item.get('ssidDetails')
                     n_item = get_dict_result(n_item, 'name', name)
                     if n_item is not None:
                         return n_item
             return result
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
             if 'ssidDetails' in items:
                 items = items.get('ssidDetails')
         result = get_dict_result(items, 'name', name)
     except Exception:
         result = None
     return result
 def get_object_by_name(self, name):
     result = None
     try:
         items = self.dnac.exec(
             family="discovery",
             function="get_global_credentials",
             params={'credential_sub_type': 'SNMPV3'},
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'description', name) or get_dict_result(items, 'username', name)
     except Exception:
         result = None
     return result
 def get_object_by_name(self, name):
     result = None
     # NOTICE: Does not have a get by name method or it is in another action
     try:
         items = self.dnac.exec(
             family="network_settings",
             function="get_global_pool",
             params=self.get_all_params(name=name),
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
             if 'settings' in items:
                 items = items.get('settings')
                 if 'ippool' in items:
                     items = items.get('ippool')
         settings = self.new_object.get('settings')
         if settings and isinstance(settings,
                                    dict) and settings.get('ippool'):
             settings = settings.get('ippool')
             if settings and isinstance(
                     settings, dict) and settings.get('ipPoolName'):
                 name = settings.get('ipPoolName')
             elif settings and isinstance(settings,
                                          list) and len(settings) > 0:
                 if settings[0].get('ipPoolName'):
                     name = settings[0].get('ipPoolName')
         result = get_dict_result(items, 'ipPoolName', name)
     except Exception:
         result = None
     return result
 def get_object_by_name(self, name):
     result = None
     # NOTICE: Does not have a get by name method, using get all
     try:
         items = self.dnac.exec(family="discovery",
                                function="get_snmp_properties")
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'systemPropertyName', name)
     except Exception:
         result = None
     return result
Exemple #5
0
 def get_object_by_id(self, id):
     result = None
     try:
         items = self.dnac.exec(family="configuration_templates",
                                function="get_template_details",
                                params={"template_id": id})
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'id', id)
     except Exception:
         result = None
     return result
 def get_object_by_id(self, id):
     result = None
     try:
         items = self.dnac.exec(family="reports",
                                function="get_a_scheduled_report",
                                params={"report_id": id})
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'reportId', id)
     except Exception:
         result = None
     return result
 def get_object_by_id(self, id):
     result = None
     try:
         items = self.dnac.exec(family="device_onboarding_pnp",
                                function="get_workflow_by_id",
                                params={"id": id})
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'id', id)
     except Exception:
         result = None
     return result
Exemple #8
0
 def get_object_by_id(self, id):
     result = None
     try:
         items = self.dnac.exec(family="tag",
                                function="get_tag_members_by_id",
                                params={"id": id})
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'id', id)
     except Exception:
         result = None
     return result
 def get_object_by_id(self, id):
     result = None
     # NOTE: Does not have a get by id method or it is in another action
     try:
         items = self.dnac.exec(family="discovery",
                                function="get_snmp_properties")
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'id', id)
     except Exception:
         result = None
     return result
 def get_object_by_id(self, id):
     result = None
     try:
         items = self.dnac.exec(
             family="policy",
             function="get_details_of_a_single_profiling_rule",
             params={"rule_id": id})
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'ruleId', id)
     except Exception:
         result = None
     return result
Exemple #11
0
 def get_object_by_id(self, id):
     result = None
     try:
         items = self.dnac.exec(
             family="discovery",
             function="get_global_credentials",
             params={'credential_sub_type': 'NETCONF'},
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'id', id)
     except Exception:
         result = None
     return result
 def get_object_by_id(self, id):
     result = None
     try:
         items = self.dnac.exec(
             family="site_design",
             function="get_floormap",
             params={"floor_id": id}
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'floorId', id)
     except Exception:
         result = None
     return result
 def get_object_by_id(self, id):
     result = None
     # Note: Does not have a get by id method or it is in another action
     try:
         items = self.dnac.exec(
             family="network_settings",
             function="get_global_pool",
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'id', id)
     except Exception:
         result = None
     return result
 def get_object_by_name(self, name):
     result = None
     # NOTICE: Does not have a get by name method or it is in another action
     try:
         items = self.dnac.exec(
             family="policy",
             function="get_list_of_profiling_rules",
             params=self.get_all_params(name=name),
         )
         if isinstance(items, dict):
             items = items['profilingRules']
         result = get_dict_result(items, 'name', name)
     except Exception:
         result = None
     return result
 def get_object_by_name(self, name):
     result = None
     # NOTICE: Does not have a get by name method or it is in another action
     try:
         items = self.dnac.exec(
             family="network_settings",
             function="get_reserve_ip_subpool",
             params=self.get_all_params(name=name),
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'name', name)
     except Exception:
         result = None
     return result
Exemple #16
0
 def get_object_by_name(self, name):
     result = None
     # NOTICE: Does not have a get by name method, using get all
     try:
         items = self.dnac.exec(
             family="fabric_wireless",
             function="get_ssid_to_ip_pool_mapping",
             params=self.get_all_params(name=name),
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'name', name)
     except Exception:
         result = None
     return result
 def get_object_by_name(self, name):
     result = None
     # NOTICE: Does not have a get by name method or it is in another action
     try:
         items = self.dnac.exec(
             family="device_onboarding_pnp",
             function="get_workflows",
             params=self.get_all_params(name=name),
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'name', name)
     except Exception:
         result = None
     return result
 def get_object_by_name(self, name):
     result = None
     # NOTICE: Does not have a get by name method, using get all
     try:
         items = self.dnac.exec(
             family="reports",
             function="get_list_of_scheduled_reports",
             params=self.get_all_params(name=name),
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'name', name)
     except Exception:
         result = None
     return result
Exemple #19
0
 def get_object_by_name(self, name):
     result = None
     # NOTICE: Does not have a get by name method, using get all
     try:
         items = self.dnac.exec(
             family="configuration_templates",
             function="gets_the_templates_available",
             params=self.get_all_params(name=name),
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'name', name)
     except Exception:
         result = None
     return result
Exemple #20
0
 def get_object_by_name(self, name):
     result = None
     # NOTICE: Does not have a get by name method, using get all
     try:
         items = self.dnac.exec(
             family="device_replacement",
             function="return_replacement_devices_with_details",
             params=self.get_all_params(name=name),
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'name', name)
     except Exception:
         result = None
     return result
 def get_object_by_name(self, name):
     result = None
     # NOTICE: Does not have a get by name method, using get all
     try:
         items = self.dnac.exec(
             family="event_management",
             function="get_syslog_event_subscriptions",
             params=self.get_all_params(name=name),
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'name', name)
     except Exception:
         result = None
     return result
 def get_object_by_id(self, id):
     result = None
     # NOTE: Does not have a get by id method or it is in another action
     try:
         items = self.dnac.exec(
             family="application_policy",
             function="get_application_sets",
             params=self.get_all_params(id=id),
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'id', id)
     except Exception:
         result = None
     return result
Exemple #23
0
 def get_object_by_name(self, name):
     result = None
     # NOTICE: Does not have a get by name method or it is in another action
     try:
         items = self.dnac.exec(
             family="application_policy",
             function="get_qos_device_interface_info",
             params=self.get_all_params(name=name),
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
         result = get_dict_result(items, 'name', name)
     except Exception:
         result = None
     return result
Exemple #24
0
 def get_object_by_id(self, id):
     result = None
     # NOTE: Does not have a get by id method or it is in another action
     try:
         items = self.dnac.exec(
             family="event_management",
             function="get_event_subscriptions",
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
             if 'subscriptionEndpoints' in items:
                 tmp_result = items.get('subscriptionEndpoints')
         tmp_result = get_dict_result(tmp_result, 'id', id)
         if tmp_result:
             result = items
     except Exception:
         result = None
     return result
Exemple #25
0
 def get_object_by_name(self, name, is_absent=False):
     result = None
     # NOTICE: Does not have a get by name method, using get all
     try:
         items = self.dnac.exec(
             family="sda",
             function="get_sda_fabric_info",
             params=self.get_all_params(name=name),
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
             if isinstance(items, dict) and items.get("status") == "failed":
                 if is_absent:
                     raise AnsibleSDAException(response=items)
                 result = None
                 return result
         result = get_dict_result(items, 'fabricName', name)
     except Exception:
         if is_absent:
             raise
         result = None
     return result
Exemple #26
0
 def get_object_by_name(self, name, is_absent=False):
     result = None
     # NOTICE: Does not have a get by name method or it is in another action
     try:
         items = self.dnac.exec(
             family="sda",
             function="get_virtual_network_with_scalable_groups",
             params=self.get_all_params(name=name),
         )
         if isinstance(items, dict):
             if 'response' in items:
                 items = items.get('response')
             if isinstance(items, dict) and items.get("status") == "failed":
                 if is_absent:
                     raise AnsibleSDAException(response=items)
                 result = None
                 return result
         result = get_dict_result(items, 'name', name)
     except Exception:
         if is_absent:
             raise
         result = None
     return result