sapcc / asr1k-neutron-l3

Cisco ASR 1000 Neutron L3 driver
Apache License 2.0
4 stars 1 forks source link

Support for deleting non-empty bridges #111

Closed sebageek closed 7 months ago

sebageek commented 7 months ago

Sometimes when the driver is trying to delete a BridgeDomain it is not empty. This then results in a InconsistentModelException with a cli error saying something like:

  <bad-cli>
    <bad-command>no bridge-domain 2157</bad-command>
    <error-location>17</error-location>
    <parser-response>Bridge-domain 2157 cannot be deleted because it is not empty (3 members)&#13;
</parser-response>
    <parser-context>no bridge-domain 2157</parser-context>
  </bad-cli>

In most cases we expect the bridge to be cleared out (as the ports are normally deleted before the network is deleted), but sometimes that is not the case, e.g. when the delete is interrupted because the device locked its config for a sync. Therefore we now add a postflight() method to our bridge that is called before the bridge is deleted, where we fetch the bridge from the device and delete all members.