コード例 #1
0
ファイル: commands.py プロジェクト: anlaneg/ovsdbapp
    def run_idl(self, txn):
        if self.may_exist:
            br = idlutils.row_by_value(self.api.idl, 'Bridge', 'name',
                                       self.name, None)
            if br:
                if self.datapath_type:
                    br.datapath_type = self.datapath_type
                self.result = br.uuid
                return
        row = txn.insert(self.api._tables['Bridge'])
        row.name = self.name
        if self.datapath_type:
            row.datapath_type = self.datapath_type
        try:
            self.api._ovs.addvalue('bridges', row)
        except AttributeError:  # OVS < 2.6
            self.api._ovs.verify('bridges')
            self.api._ovs.bridges = self.api._ovs.bridges + [row]

        # Add the internal bridge port
        cmd = AddPortCommand(self.api, self.name, self.name, self.may_exist)
        cmd.run_idl(txn)

        cmd = command.DbSetCommand(self.api, 'Interface', self.name,
                                   ('type', 'internal'))
        cmd.run_idl(txn)
        self.result = row.uuid
コード例 #2
0
 def db_set(self, table, record, *col_values):
     return cmd.DbSetCommand(self, table, record, *col_values)