1
# Copyright 2013 VMware, Inc.
5
# Licensed under the Apache License, Version 2.0 (the "License"); you may
6
# not use this file except in compliance with the License. You may obtain
7
# a copy of the License at
9
# http://www.apache.org/licenses/LICENSE-2.0
11
# Unless required by applicable law or agreed to in writing, software
12
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
# License for the specific language governing permissions and limitations
17
from neutron.openstack.common import log as logging
18
from neutron.plugins.vmware.dbexts import vcns_models
20
LOG = logging.getLogger(__name__)
23
def add_vcns_router_binding(session, router_id, vse_id, lswitch_id, status):
24
with session.begin(subtransactions=True):
25
binding = vcns_models.VcnsRouterBinding(
28
lswitch_id=lswitch_id,
34
def get_vcns_router_binding(session, router_id):
35
with session.begin(subtransactions=True):
36
return (session.query(vcns_models.VcnsRouterBinding).
37
filter_by(router_id=router_id).first())
40
def update_vcns_router_binding(session, router_id, **kwargs):
41
with session.begin(subtransactions=True):
42
binding = (session.query(vcns_models.VcnsRouterBinding).
43
filter_by(router_id=router_id).one())
44
for key, value in kwargs.iteritems():
48
def delete_vcns_router_binding(session, router_id):
49
with session.begin(subtransactions=True):
50
binding = (session.query(vcns_models.VcnsRouterBinding).
51
filter_by(router_id=router_id).one())
52
session.delete(binding)