Example #1
0
    def make_static_route(self, static_route):
        '''
        {"ip_address":"172.28.0.0",
         "mask_length":"24",
         "next_hop_address":"172.28.0.1",
         "outgoing_interface":"eth3",
         "priority":"63",
         "description":"aaaaaaaaaaa"
         }
        '''
        LOG.debug(_('enter _make_static_route.'))
        ret = self.check_static_route("add", static_route)
        if not ret:
            LOG.error(_('static_route is invalid.'))
            return False

        bodyinfo = ngfw_utils.get_static_route(static_route)
        LOG.debug(_('_make_static_route xml body is: %s' % bodyinfo))
        response = self.rest.rest_api('POST', ngfw_utils.NGFW_URL_STATIC_ROUTE,
                                      bodyinfo)
        if response['status'] >= 400:
            LOG.error(_('_make_static_route failed.'))
            return False
        LOG.debug(_('_make_static_route success.'))
        return True
 def clear_static_route(self, static_route):
     LOG.debug(_('enter _clear_static_route.'))
     ret = self.check_static_route("delete", static_route)
     if not ret:
         LOG.error(_('static_route is invalid.'))
         return False
 
     bodyinfo = ngfw_utils.get_static_route(static_route)
     LOG.debug(_('_clear_static_route xml body is: %s' % bodyinfo))
     response = self.rest.rest_api('DELETE', ngfw_utils.NGFW_URL_STATIC_ROUTE, bodyinfo)
     if response['status'] >= 200 and response['status'] < 300:
         return True
     return False
Example #3
0
    def clear_static_route(self, static_route):
        LOG.debug(_('enter _clear_static_route.'))
        ret = self.check_static_route("delete", static_route)
        if not ret:
            LOG.error(_('static_route is invalid.'))
            return False

        bodyinfo = ngfw_utils.get_static_route(static_route)
        LOG.debug(_('_clear_static_route xml body is: %s' % bodyinfo))
        response = self.rest.rest_api('DELETE',
                                      ngfw_utils.NGFW_URL_STATIC_ROUTE,
                                      bodyinfo)
        if response['status'] >= 200 and response['status'] < 300:
            return True
        return False
 def make_static_route(self, static_route):
     '''
     {"ip_address":"172.28.0.0",
      "mask_length":"24",
      "next_hop_address":"172.28.0.1",
      "outgoing_interface":"eth3",
      "priority":"63",
      "description":"aaaaaaaaaaa"
      }
     '''
     LOG.debug(_('enter _make_static_route.'))
     ret = self.check_static_route("add", static_route)
     if not ret:
         LOG.error(_('static_route is invalid.'))
         return False
 
     bodyinfo = ngfw_utils.get_static_route(static_route)
     LOG.debug(_('_make_static_route xml body is: %s' % bodyinfo))
     response = self.rest.rest_api('POST', ngfw_utils.NGFW_URL_STATIC_ROUTE, bodyinfo)
     if response['status'] >= 400:
         LOG.error(_('_make_static_route failed.'))
         return False
     LOG.debug(_('_make_static_route success.'))
     return True