예제 #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"]
예제 #2
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"]
예제 #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)
예제 #5
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)
예제 #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
예제 #7
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
예제 #8
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)
예제 #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)