Ejemplo n.º 1
0
def add_logical_switch(context, record_dict):
    """Insert a new logical switch."""
    session = context.session
    with session.begin(subtransactions=True):
        logical_switch = models.LogicalSwitches(
            uuid=record_dict['uuid'],
            name=record_dict['name'],
            key=record_dict['key'],
            ovsdb_identifier=record_dict['ovsdb_identifier'])
        session.add(logical_switch)
Ejemplo n.º 2
0
 def _create_logical_switch(self, record_dict, name=None):
     if name:
         record_dict['name'] = name
     with self.ctx.session.begin(subtransactions=True):
         entry = models.LogicalSwitches(
             uuid=record_dict['uuid'],
             name=record_dict['name'],
             key=record_dict['key'],
             ovsdb_identifier=record_dict['ovsdb_identifier'])
         self.ctx.session.add(entry)
         return entry