def test_update_bnp_phys_switch_status(self): sw_dict = self._get_bnp_phys_switch_dict() db.add_bnp_phys_switch(self.ctx, sw_dict) switches = db.get_all_bnp_phys_switches(self.ctx) db.update_bnp_phys_switch_status(self.ctx, switches[0]['id'], "disable") sw_updt = self.ctx.session.query(models.BNPPhysicalSwitch).all() self.assertNotEqual(sw_updt[0]['status'], "disable")
def index(self, request, **kwargs): context = request.context req_dict = dict(request.GET) if req_dict and req_dict.get('fields', None): req_dict.pop('fields') filters = req_dict switches = db.get_all_bnp_phys_switches(context, **filters) switches = self._switch_to_show(switches) switches_dict = {'bnp_switches': switches} return switches_dict
def test_update_bnp_phys_switch_access_params(self): """Tests update_bnp_phys_switch_access_params method.""" sw_dict = self._get_bnp_phys_switch_dict() param_dict = self._get_bnp_access_param_dict() db.add_bnp_phys_switch(self.ctx, sw_dict) switches = db.get_all_bnp_phys_switches(self.ctx) db.update_bnp_phys_switch_access_params(self.ctx, switches[0]['id'], param_dict) sw_updt = self.ctx.session.query(models.BNPPhysicalSwitch).all() self.assertNotEqual(sw_updt[0]['access_protocol'], "snmpv3")
def index(self, request): context = request.context switches = db.get_all_bnp_phys_switches(context) switches = self._switch_to_show(switches) switches_dict = {'bnp-switches': switches} return switches_dict
def test_get_all_bnp_phys_switches(self): """Test get_all__bnp_phys_switches method.""" sw_dict = self._get_bnp_phys_switch_dict() db.add_bnp_phys_switch(self.ctx, sw_dict) switches = db.get_all_bnp_phys_switches(self.ctx) self.assertEqual(1, len(switches))