Example #1
0
 def _test_create_time(self, func, resource, resources=None):
     if not resources:
         resources = resource + "s"
     _now = timeutils.utcnow()
     with func() as obj:
         _obj = self._show(resources, obj[resource]['id'])
         c_time = _obj[resource]['created_at']
         _c = timeutils.parse_strtime(c_time)
     delta = timeutils.delta_seconds(_now, _c)
     self.assertTrue(delta > 0)
 def report_state(self, context, **kwargs):
     """Report state from agent to server."""
     time = kwargs['time']
     time = timeutils.parse_strtime(time)
     if self.START_TIME > time:
         LOG.debug(_("Message with invalid timestamp received"))
         return
     agent_state = kwargs['agent_state']['agent_state']
     plugin = manager.NeutronManager.get_plugin()
     plugin.create_or_update_agent(context, agent_state)
Example #3
0
 def _test_create_time(self, func, resource, resources=None):
     if not resources:
         resources = resource + "s"
     _now = timeutils.utcnow()
     with func() as obj:
         _obj = self._show(resources, obj[resource]['id'])
         c_time = _obj[resource]['created_at']
         _c = timeutils.parse_strtime(c_time)
     delta = timeutils.delta_seconds(_now, _c)
     self.assertTrue(delta > 0)
Example #4
0
 def report_state(self, context, **kwargs):
     """Report state from agent to server."""
     time = kwargs['time']
     time = timeutils.parse_strtime(time)
     if self.START_TIME > time:
         LOG.debug(_("Message with invalid timestamp received"))
         return
     agent_state = kwargs['agent_state']['agent_state']
     if not self.plugin:
         self.plugin = manager.NeutronManager.get_plugin()
     self.plugin.create_or_update_agent(context, agent_state)
 def test_router_create(self):
     name = 'router1'
     tenant_id = _uuid()
     expected_value = [('name', name), ('tenant_id', tenant_id),
                       ('admin_state_up', True), ('status', 'ACTIVE'),
                       ('external_gateway_info', None)]
     _now = timeutils.utcnow()
     with self.router(name='router1', admin_state_up=True,
                      tenant_id=tenant_id) as router:
         for k, v in expected_value:
             self.assertEqual(router['router'][k], v)
         _created = timeutils.parse_strtime(router['router']['created_at'])
         delta = timeutils.delta_seconds(_now, _created)
         self.assertTrue(delta > 0)
 def report_state(self, context, data):
     if not data['ip'] or data['status'] == 'DOWN':
         return
     
     report_time = data['time']
     report_time = timeutils.parse_strtime(report_time)
     
     if self.START_TIME > report_time:
         LOG.debug(_("Message with invalid timestamp received"))
     else:
         ip = data['ip']
         if ip not in self.manager.proxy_ips:
             self.manager.proxy_ips[ip] = {}
             self.manager.proxy_ips[ip]['flag'] = False 
         self.manager.proxy_ips[ip]['time'] = report_time
Example #7
0
    def report_state(self, context, data):
        if not data['ip'] or data['status'] == 'DOWN':
            return

        report_time = data['time']
        report_time = timeutils.parse_strtime(report_time)

        if self.START_TIME > report_time:
            LOG.debug(_("Message with invalid timestamp received"))
        else:
            ip = data['ip']
            if ip not in self.manager.proxy_ips:
                self.manager.proxy_ips[ip] = {}
                self.manager.proxy_ips[ip]['flag'] = False
            self.manager.proxy_ips[ip]['time'] = report_time
Example #8
0
 def report_state(self, context, **kwargs):
     """Report state from agent to server."""
     time = kwargs['time']
     time = timeutils.parse_strtime(time)
     if self.START_TIME > time:
         LOG.debug(_("Message with invalid timestamp received"))
         raise ext_agent.AgentInvalidTimestamp()
     agent_state = kwargs['agent_state']['agent_state']
     if not self.plugin:
         self.plugin = manager.NeutronManager.get_plugin()
     self.plugin.create_or_update_agent(context, agent_state)
     if cfg.CONF.isolate_relay_cidr and agent_state['binary'] =='neutron-l3-agent':
         start_flag = agent_state.get('start_flag', None)
         if start_flag:
             return {'isolate_relay_cidr':cfg.CONF.isolate_relay_cidr}
 def test_router_create(self):
     name = 'router1'
     tenant_id = _uuid()
     expected_value = [('name', name), ('tenant_id', tenant_id),
                       ('admin_state_up', True), ('status', 'ACTIVE'),
                       ('external_gateway_info', None)]
     _now = timeutils.utcnow()
     with self.router(name='router1',
                      admin_state_up=True,
                      tenant_id=tenant_id) as router:
         for k, v in expected_value:
             self.assertEqual(router['router'][k], v)
         _created = timeutils.parse_strtime(router['router']['created_at'])
         delta = timeutils.delta_seconds(_now, _created)
         self.assertTrue(delta > 0)
Example #10
0
    def report_state(self, context, data):
        if not data["ip"] or data["status"] == "DOWN":
            return

        report_time = data["time"]
        report_time = timeutils.parse_strtime(report_time)

        if self.START_TIME > report_time:
            LOG.debug(_("Message with invalid timestamp received"))
        else:
            ip = data["ip"]
            if ip not in self.manager.proxy_ips:
                self.manager.proxy_ips[ip] = {}
                self.manager.proxy_ips[ip]["flag"] = False
            self.manager.proxy_ips[ip]["time"] = report_time
Example #11
0
 def report_state(self, context, **kwargs):
     """Report state from agent to server."""
     time = kwargs['time']
     time = timeutils.parse_strtime(time)
     if self.START_TIME > time:
         LOG.debug(_("Message with invalid timestamp received"))
         raise ext_agent.AgentInvalidTimestamp()
     agent_state = kwargs['agent_state']['agent_state']
     if not self.plugin:
         self.plugin = manager.NeutronManager.get_plugin()
     self.plugin.create_or_update_agent(context, agent_state)
     if cfg.CONF.isolate_relay_cidr and agent_state[
             'binary'] == 'neutron-l3-agent':
         start_flag = agent_state.get('start_flag', None)
         if start_flag:
             return {'isolate_relay_cidr': cfg.CONF.isolate_relay_cidr}