Esempio n. 1
0
 def _parse_function_block_plugs(self):
     fbs = {}
     subunits = BcoSubunitInfo.get_subunits(self.fcp)
     for type in self.subunit_plugs.keys():
         subunit_fbs = {}
         entries = []
         for i in range(0xff):
             try:
                 entries.extend(BcoSubunitInfo.get_subunit_fb_info(self.fcp,
                                                         type, 0, i, 0xff))
             except:
                 break
         for entry in entries:
             fb_type = entry['fb-type']
             if fb_type not in subunit_fbs:
                 subunit_fbs[fb_type] = {}
             fb_id = entry['fb-id']
             if fb_id not in subunit_fbs[fb_type]:
                 subunit_fbs[fb_type][fb_id] = {}
                 subunit_fbs[fb_type][fb_id]['output'] = {}
                 subunit_fbs[fb_type][fb_id]['input'] = {}
             for i in range(entry['inputs']):
                 plug = self._parse_fb_plug('input', type, 0,
                                            fb_type, fb_id, i)
                 subunit_fbs[fb_type][fb_id]['output'][i] = plug
             for i in range(entry['outputs']):
                 plug = self._parse_fb_plug('output', type, 0,
                                            fb_type, fb_id, i)
                 subunit_fbs[fb_type][fb_id]['input'][i] = plug
         fbs[type] = subunit_fbs
     return fbs
Esempio n. 2
0
 def _parse_subunit_plugs(self):
     subunit_plugs = {}
     subunits = BcoSubunitInfo.get_subunits(self.fcp)
     for subunit in subunits:
         type = subunit['type']
         id = subunit['id']
         if subunit['id'] != 0:
             raise RuntimeError('Unsupported number for subunit id')
         if type not in subunit_plugs:
             subunit_plugs[type] = {}
             subunit_plugs[type]['output'] = {}
             subunit_plugs[type]['input'] = {}
         info = AvcConnection.get_subunit_plug_info(self.fcp, type, 0)
         for dir, num in info.items():
             for i in range(num):
                 plug = self._parse_subunit_plug(dir, type, 0, i)
                 subunit_plugs[type][dir][i] = plug
     return subunit_plugs