def testGetBondingOptions(self): INTERVAL = '12345' bondName = random_iface_name() with open(bonding.BONDING_MASTERS, 'w') as bonds: bonds.write('+' + bondName) bonds.flush() try: # no error is anticipated but let's make sure we can clean up self.assertEqual( bonding._getBondingOptions(bondName), {}, "This test fails" " when a new bonding option is added to the kernel. Please" " run vdsm-tool dump-bonding-options` and retest.") with open(bonding.BONDING_OPT % (bondName, 'miimon'), 'w') as opt: opt.write(INTERVAL) self.assertEqual(bonding._getBondingOptions(bondName), {'miimon': INTERVAL}) finally: bonds.write('-' + bondName)
def _bond_opts_without_mode(bond_name): opts = bonding._getBondingOptions(bond_name) opts.pop('mode') return opts