Skip to content

Instantly share code, notes, and snippets.

@Xeite
Created January 8, 2019 09:46
Show Gist options
  • Save Xeite/455f30e9b3547c15e471ca6682898ed3 to your computer and use it in GitHub Desktop.
Save Xeite/455f30e9b3547c15e471ca6682898ed3 to your computer and use it in GitHub Desktop.
hostroute.py
# Copyright 2018 Kakao Corp.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_log import log as logging
from neutron.agent.l3 import l3_agent_extension
from networking_kakao.agent.l3.extensions.dvr_hostroute_router \
import DvrHostrouteRouter
LOG = logging.getLogger(__name__)
class HostrouteAgentExtension(l3_agent_extension.L3AgentCoreResourceExtension):
def initialize(self, connection, driver_type):
"""Replace 'distributed' featured router with 'DvrHostrouteRouter'"""
self.agent_api.register_router(['distributed'], DvrHostrouteRouter)
LOG.info("Router 'DvrHostrouteRouter' for 'distributed' registered")
def consume_api(self, agent_api):
self.agent_api = agent_api
def add_router(self, context, data):
"""Nothing to do for router hook"""
pass
def update_router(self, context, data):
"""Nothing to do for router hook"""
pass
def delete_router(self, context, data):
"""Nothing to do for router hook"""
pass
def ha_state_change(self, context, data):
"""Nothing to do for router hook"""
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment