# Remove a software bridge and its management

This sample application demonstrates how to remove a software bridge and its management.

1. Implement initialization callback Get the DataFactory instances

Optionally initialization callback can be provided with get manager instance.
Data factory will call callback when manager initialization is complete.

auto initCb = [&](telux::common::ServiceStatus status) {
       std::lock_guard<std::mutex> lock(mtx);
       status_ = status;
       initCv.notify_all();
    };
    
    auto &dataFactory = telux::data::DataFactory::getInstance();
    Copy to clipboard

2. Get the BridgeManager instances

std::unique_lock<std::mutex> lck(mtx);
    auto dataBridgeMgr  = dataFactory.getBridgeManager(initCb);
    Copy to clipboard

3. Wait for BridgeManager initialization to be complete

initCv.wait(lck);
    Copy to clipboard

3.1 Check BridgeManager initialization state

BridgeManager needs to be ready to remove a software bridge and disable the software bridge
management in the system. If BridgeManager initialization failed, new initialization attempt can
be accomplished by calling step 2. If BridgeManager initialization succeed, proceed to step 4.

if (status_ == telux::common::ServiceStatus::SERVICE_AVAILABLE) {
       // Go to step 4
    }
    else {
       //Go to step 2 for another initialization attempt
    }
    Copy to clipboard

4. Implement callbacks to get, remove software bridge and disable the software bridge management

auto respCbGet = [](const std::vector<BridgeInfo> &configs, telux::common::ErrorCode error) {
        std::cout << "CALLBACK: "
                  << "Get software bridge info request"
                  << (error == telux::common::ErrorCode::SUCCESS ? " is successful" : " failed")
                  << ". ErrorCode: " << static_cast<int>(error)
                  << ", description: " << Utils::getErrorCodeAsString(error) << std::endl;
        for (auto c : configs) {
            std::cout << "Iface name: " << c.ifaceName << ", ifaceType: " << (int)c.ifaceType
                      << ", bandwidth: " << c.bandwidth << std::endl;
        }
    };
    
    auto respCbRemove = [](telux::common::ErrorCode error) {
        std::cout << "CALLBACK: "
                  << "Remove software bridge request"
                  << (error == telux::common::ErrorCode::SUCCESS ? " is successful" : " failed")
                  << ". ErrorCode: " << static_cast<int>(error)
                  << ", description: " << Utils::getErrorCodeAsString(error) << std::endl;
    };
    
    auto respCbDisable = [](telux::common::ErrorCode error) {
        std::cout << "CALLBACK: "
                  << "Disable software bridge management request is"
                  << (error == telux::common::ErrorCode::SUCCESS ? " successful" : " failed")
                  << ". ErrorCode: " << static_cast<int>(error)
                  << ", description: " << Utils::getErrorCodeAsString(error) << std::endl;
    };
    Copy to clipboard

5. Get the list of software bridges configured in the system

dataBridgeMgr->requestBridgeInfo(respCbGet);
    Copy to clipboard

Now, response callback will be invoked with the list of software bridges.

6. Remove the software bridge from the configured bridges, based on the interface name

dataBridgeMgr->removeBridge(ifaceName, respCbRemove);
    Copy to clipboard

Now, response callback will be invoked with the removeBridge response.

7. Disable the software bridge management (if required)

bool enable = false;
    dataBridgeMgr->enableBridge(enable, respCbDisable);
    Copy to clipboard

Now, response callback will be invoked with the enableBridge response.

Last Published: Apr 14, 2026

[Previous Topic
Adding a software bridge and enable its management](https://docs.qualcomm.com/bundle/publicresource/80-PF458-1/topics/add_enable_software_bridge.md) [Next Topic
Create VLAN And bind it to a PDN](https://docs.qualcomm.com/bundle/publicresource/80-PF458-1/topics/create_and_bind_vlan.md)