def test_set_config_app_fcoe(self):
     r = dcbtool.parse_set("dcbtool sc eth3 app:0 e:1 a:1 w:1 appcfg:20")
     self.assertEqual(r['enable'], True)
     self.assertEqual(r['willing'], True)
     self.assertEqual(r['advertise'], True)
     self.assertEqual(r['interface'], "eth3")
     self.assertEqual(r['appcfg'], 32)
 def from_dcbtool_set(cls, output):
     cli = dcbtool.parse_set(output)
     # 8 is default and cannot be overridden by dcbtool sc
     return cls(
         control=DCBControlModel(
             enable=cli['enable'],
             advertise=cli['advertise'],
             willing=cli['willing']),
         data=PFCModel(
             enabled=cli['pfcup'],
             max_tcs=8))
 def test_set_config_pg(self):
     r = dcbtool.parse_set(
         "dcbtool sc eth3 pg e:1 a:1 w:1 uppct:7,6,5,4,3,2,1,0 pgid:00111010 pgpct:0,1,2,3,4,5,6,7")
     self.assertEqual(r['enable'], True)
     self.assertEqual(r['willing'], True)
     self.assertEqual(r['advertise'], True)
     self.assertEqual(r['interface'], "eth3")
     self.assertEqual(r['pgid'], {
                      0: 0, 1: 0, 2: 1, 3: 1, 4: 1, 5: 0, 6: 1, 7: 0})
     self.assertEqual(r['pgpct'], (0, 1, 2, 3, 4, 5, 6, 7))
     self.assertEqual(r['uppct'], (7, 6, 5, 4, 3, 2, 1, 0))
        def from_dcbtool_set(cls, output):
            cli = dcbtool.parse_set(output)
            tsa_map, up2tc = DCBTool.cee_to_ieee_ets(cli['pgid'])

            return cls(
                control=DCBControlModel(
                    enable=cli['enable'],
                    advertise=cli['advertise'],
                    willing=cli['willing']),
                data=ETSModel(
                    up2tc=up2tc,
                    tcbw=cli['pgpct'],
                    tsa=tsa_map))
 def from_dcbtool_set(cls, output):
     cli = dcbtool.parse_set(output)
     selector, protocol = cls.get_protocol_and_selector(cli['feature'])
     priorities = bitmask_to_dict(cli['appcfg'])
     applications = dict(
         ((AppPriorityEntry(priority=up, selector=selector,
          protocol=protocol), True) for up in priorities)
     )
     return cls(
         control=DCBControlModel(
             enable=cli['enable'],
             advertise=cli['advertise'],
             willing=cli['willing']),
         data=AppModel(
             applications=applications))
 def test_set_config_pfc(self):
     r = dcbtool.parse_set("dcbtool sc eth3 pfc e:1 a:1 w:1 pfcup:00111010")
     self.assertEqual(r['enable'], True)
     self.assertEqual(r['willing'], True)
     self.assertEqual(r['advertise'], True)
     self.assertEqual(r['interface'], "eth3")
     self.assertEqual(r['pfcup'], {
         0: False,
         1: False,
         2: True,
         3: True,
         4: True,
         5: False,
         6: True,
         7: False
     })