Пример #1
0
 def enumerate(self,
               clsName,
               resource,
               select={},
               resetTransport=False,
               filter=None):
     wsm = WsManRequest()
     wsm.enumerate(to=self._proto_endpoint(),
                   ruri=resource,
                   selectors=select,
                   filter=filter)
     return self._communicate(wsm)
Пример #2
0
    def operation(self, wsmancmds, cmdname, *args):
        ruri = wsmancmds[cmdname]["ResourceURI"]
        act = wsmancmds[cmdname]["Action"]
        sset = {}
        tset = wsmancmds[cmdname]["SelectorSet"]
        for i in tset["w:Selector"]:
            sset[i['@Name']] = i['#text']
        toargs = self._build_ops(wsmancmds, cmdname, *args)

        wsm = WsManRequest()
        wsm.set_header(self._proto_endpoint(), ruri, (ruri + "/" + act))
        wsm.add_selectors(sset)
        wsm.add_body(ruri, act, toargs['retval'])
        return self._communicate(wsm)
Пример #3
0
    def operation(self, wsmancmds, cmdname, *args):
        ##########################Below are redfish codes, need to be removed once prtocol issue is addressed#####################
        cmmd = str(cmdname)
        if cmmd.endswith("_redfish"):
            return self.redfish_operation(wsmancmds, cmdname, *args)
        ##########################Above are redfish codes, need to be removed once prtocol issue is addressed#####################
        ruri = wsmancmds[cmdname]["ResourceURI"]
        act = wsmancmds[cmdname]["Action"]
        sset = {}
        tset = wsmancmds[cmdname]["SelectorSet"]
        for i in tset["w:Selector"]:
            sset[i['@Name']] = i['#text']
        toargs = self._build_ops(wsmancmds, cmdname, *args)

        wsm = WsManRequest()
        wsm.set_header(self._proto_endpoint(), ruri, (ruri + "/" + act))
        wsm.add_selectors(sset)
        wsm.add_body(ruri, act, toargs['retval'])
        return self._communicate(wsm)
Пример #4
0
 def _communicate(self, wsm, name=None):
     try:
         self._proto_connect()
         self._logger.debug("Sending: " + wsm.get_text())
         result = self._proto_ship_payload(wsm.get_text())
         self._logger.debug("Received: " + str(result))
         en = WsManResponse().execute_str(result)
         out = self._parse_output(en, name)
         return out
     except Exception as ex:
         self._logger.debug(str(ex))
         # fake as if the error came from the WsMan subsystem
         sx = WsManRequest()
         sx.add_error(ex)
         self._logger.debug(sx.get_text())
         en = WsManResponse().execute_str(sx.get_text())
         out = self._parse_output(en)
         return out
Пример #5
0
 def opget(self, ruri, name, args):
     act = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"
     wsm = WsManRequest()
     wsm.set_header(self._proto_endpoint(), ruri, act)
     wsm.add_selectors(args)
     return self._communicate(wsm, name)
Пример #6
0
 def identify(self):
     """ Identifies the target product """
     wsm = WsManRequest()
     wsm.identify()
     return self._communicate(wsm)