コード例 #1
0
ファイル: views.py プロジェクト: bigswitch/horizon
 def get_data(self):
     test_data = None
     api = ReachabilityTestAPI()
     with bsn_api.Session.begin(subtransactions=True):
         test = api.getQuickTest(self.request.user.project_id,
                                 bsn_api.Session)
         result = api.getLastReachabilityQuickTestResult(
             self.request.user.project_id, bsn_api.Session)
         test_data = ReachabilityTestData(test, result)
     return test_data
コード例 #2
0
ファイル: forms.py プロジェクト: bigswitch/horizon
 def handle(self, request, data):
     testargs = {
         'tenant_id': request.user.project_id,
         'src_tenant_id': data['tenant_source'].encode('ascii'),
         'src_segment_id': data['segment_source'].encode('ascii'),
         'src_ip': data['ip_source'].encode('ascii', 'ignore'),
         'dst_ip': data['ip_destination'].encode('ascii', 'ignore'),
         'expected_result': data['expected_connection'].encode('ascii',
                                                               'ignore')
     }
     api = reachability_test_api.ReachabilityTestAPI()
     with bsn_api.Session.begin(subtransactions=True):
         test = reachability_test_db.ReachabilityQuickTest(**testargs)
         api.addQuickTest(test, bsn_api.Session)
         api.runQuickTest(request.user.project_id, bsn_api.Session)
         test = api.getQuickTest(request.user.project_id, bsn_api.Session)
     messages.success(request, _('Successfully ran quick test.'))
     return test