

def make_bond_via_api(self, bond_name, bond_mode, nic_names, node_id=None, bond_properties=None, interface_properties=None):
    if (not node_id):
        node_id = self.nodes[0]['id']
    resp = self.app.get(reverse('NodeNICsHandler', kwargs={
        'node_id': node_id,
    }), headers=self.default_headers)
    self.tester.assertEqual(resp.status_code, 200)
    data = resp.json_body
    nics = self.db.query(NodeNICInterface).filter(NodeNICInterface.name.in_(nic_names)).filter((NodeNICInterface.node_id == node_id))
    node_id.tester.assertEqual(nics.count(), len(nic_names))
    (assigned_nets, slaves) = ([], [])
    for nic in data:
        if (nic['name'] in nic_names):
            assigned_nets.extend(nic['assigned_networks'])
            slaves.append({
                'name': nic['name'],
            })
            nic['assigned_networks'] = []
    bond_dict = {
        'name': bond_name,
        'type': NETWORK_INTERFACE_TYPES.bond,
        'mode': bond_mode,
        'slaves': slaves,
        'assigned_networks': assigned_nets,
    }
    if bond_properties:
        bond_dict['bond_properties'] = bond_properties
    else:
        bond_dict['bond_properties'] = {
            
        }
    if interface_properties:
        bond_dict['interface_properties'] = interface_properties
    else:
        bond_dict['interface_properties'] = {
            
        }
    data.append(bond_dict)
    resp = self.node_nics_put(node_id, data)
    self.tester.assertEqual(resp.status_code, 200)

dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/test/base.py EnvironmentManager.make_bond_via_api/VarMisuse@133/187 `self`->`node_id`