示例#1
0
 def san_fabrics_list(self, networkname):
     obj = Networksystem(self.__ipAddr, self.__port)
     nsuri = obj.networksystem_query(networkname)
     (s, h) = common.service_json_request(
         self.__ipAddr, self.__port, "GET",
         SanFabrics.URI_SAN_FABRICS_LIST.format(nsuri), None)
     o = common.json_decode(s)
     return o["fabric"]
 def san_fabrics_list(self, networkname):
     obj = Networksystem(self.__ipAddr, self.__port)
     nsuri = obj.networksystem_query(networkname)
     (s, h) = common.service_json_request(self.__ipAddr, self.__port,
         "GET",
         SanFabrics.URI_SAN_FABRICS_LIST.format(nsuri),
         None)
     o = common.json_decode(s)
     return o["fabric"]
示例#3
0
 def san_fabrics_zones_list(self,
                            networkname,
                            fabricid,
                            excludealiases,
                            xml=False):
     obj = Networksystem(self.__ipAddr, self.__port)
     nsuri = obj.networksystem_query(networkname)
     return self.show_fabrics_zones_by_uri(nsuri, fabricid, excludealiases,
                                           xml)
示例#4
0
    def san_fabrics_activate(self, networkname, fabricid):
        obj = Networksystem(self.__ipAddr, self.__port)
        nsuri = obj.networksystem_query(networkname)

        req_rest_api = SanFabrics.URI_SAN_FABRICS_ZONE_LIST.format(
            nsuri, fabricid)
        req_rest_api = req_rest_api + '/activate'
        (s, h) = common.service_json_request(self.__ipAddr, self.__port,
                                             "POST", req_rest_api, None)
        return common.json_decode(s)
    def san_fabrics_activate(self, networkname, fabricid):
        obj = Networksystem(self.__ipAddr, self.__port)
        nsuri = obj.networksystem_query(networkname)

        req_rest_api = SanFabrics.URI_SAN_FABRICS_ZONE_LIST.format(nsuri,
                                                             fabricid)
        req_rest_api = req_rest_api + '/activate'
        (s, h) = common.service_json_request(self.__ipAddr, self.__port,
                                        "POST",
                                        req_rest_api,
                                        None)
        return common.json_decode(s)
示例#6
0
    def show_san_fabrics_zone(self, name, fabricid, sanzone, xml=False):
        obj = Networksystem(self.__ipAddr, self.__port)
        nsuri = obj.networksystem_query(name)

        restapi = SanFabrics.URI_SAN_FABRICS_ZONE_LIST.format(nsuri, fabricid)
        restapi = restapi + "?zone-name=" + sanzone + "&exclude-members=false"
        if (xml == False):
            (s, h) = common.service_json_request(self.__ipAddr, self.__port,
                                                 "GET", restapi, None)
            return common.json_decode(s)
        else:
            (s, h) = common.service_json_request(self.__ipAddr, self.__port,
                                                 "GET", restapi, None, None,
                                                 xml)
            return s
    def show_san_fabrics_zone(self, name, fabricid, sanzone, xml=False):
        obj = Networksystem(self.__ipAddr, self.__port)
        nsuri = obj.networksystem_query(name)

        restapi = SanFabrics.URI_SAN_FABRICS_ZONE_LIST.format(nsuri, fabricid)
        restapi = restapi + "?zone-name=" + sanzone + "&exclude-members=false"
        if(xml == False):
            (s, h) = common.service_json_request(self.__ipAddr, self.__port,
                                                    "GET",
                                                    restapi,
                                                    None)
            return common.json_decode(s)
        else:
            (s, h) = common.service_json_request(self.__ipAddr, self.__port,
                                                    "GET",
                                                    restapi,
                                                    None, None, xml)
            return s
    def san_fabric_zone_update(self, operation, networkname,
                                              fabricid,
                                              sanname,
                                              addwwwpns,
                                              removewwpns):
        obj = Networksystem(self.__ipAddr, self.__port)
        nsuri = obj.networksystem_query(networkname)
        req_rest_api = SanFabrics.URI_SAN_FABRICS_ZONE_LIST.format(nsuri,
                                                             fabricid)
        zonesParam = []
        updateParam = dict()
        req_type = "POST"
        if("add" == operation):
            req_type = "POST"
            zonesParam.append({'name': sanname, 'members': addwwwpns})
            updateParam['san_zone'] = zonesParam
        elif("remove" == operation):
            req_type = "POST"
            req_rest_api = req_rest_api + '/remove'
            zonesParam.append({'name': sanname, 'members': removewwpns})
            updateParam['san_zone'] = zonesParam
        else:
            req_type = "PUT"
            addMembers = []
            if(addwwwpns != None):
                addMembers = addwwwpns
            removeMembers = []
            if(removewwpns != None):
                removeMembers = removewwpns

            zonesParam.append(
                {'name': sanname, 'add': addMembers, 'remove': removeMembers})
            updateParam['san_zone_update'] = zonesParam

        body = json.dumps(updateParam)
        (s, h) = common.service_json_request(self.__ipAddr, self.__port,
                                        req_type,
                                        req_rest_api,
                                        body)
        return common.json_decode(s)
示例#9
0
    def san_fabric_zone_update(self, operation, networkname, fabricid, sanname,
                               addwwwpns, removewwpns):
        obj = Networksystem(self.__ipAddr, self.__port)
        nsuri = obj.networksystem_query(networkname)
        req_rest_api = SanFabrics.URI_SAN_FABRICS_ZONE_LIST.format(
            nsuri, fabricid)
        zonesParam = []
        updateParam = dict()
        req_type = "POST"
        if ("add" == operation):
            req_type = "POST"
            zonesParam.append({'name': sanname, 'members': addwwwpns})
            updateParam['san_zone'] = zonesParam
        elif ("remove" == operation):
            req_type = "POST"
            req_rest_api = req_rest_api + '/remove'
            zonesParam.append({'name': sanname, 'members': removewwpns})
            updateParam['san_zone'] = zonesParam
        else:
            req_type = "PUT"
            addMembers = []
            if (addwwwpns != None):
                addMembers = addwwwpns
            removeMembers = []
            if (removewwpns != None):
                removeMembers = removewwpns

            zonesParam.append({
                'name': sanname,
                'add': addMembers,
                'remove': removeMembers
            })
            updateParam['san_zone_update'] = zonesParam

        body = json.dumps(updateParam)
        (s, h) = common.service_json_request(self.__ipAddr, self.__port,
                                             req_type, req_rest_api, body)
        return common.json_decode(s)
示例#10
0
 def san_fabrics_zones_list(self, networkname, fabricid, xml=False):
     obj = Networksystem(self.__ipAddr, self.__port)
     nsuri = obj.networksystem_query(networkname)
     return self.show_fabrics_zones_by_uri(nsuri, fabricid, xml)