def contrail_controller_node_departed():
    units = [unit for rid in relation_ids("contrail-controller")
                      for unit in related_units(rid)]
    if units:
        return

    config["vrouter-expected-provision-state"] = False
    update_vrouter_provision_status()
    status_set("blocked", "Missing relation to contrail-controller")
def contrail_controller_changed():
    data = relation_get()
    log("RelData: " + str(data))

    def _update_config(key, data_key):
        if data_key in data:
            config[key] = data[data_key]

    _update_config("analytics_servers", "analytics-server")
    _update_config("api_ip", "private-address")
    _update_config("api_port", "port")
    _update_config("auth_info", "auth-info")
    _update_config("orchestrator_info", "orchestrator-info")
    config["vrouter-expected-provision-state"] = True
    config.save()

    write_configs()
    update_vrouter_provision_status()
    update_unit_status()
def update_status():
    update_vrouter_provision_status()
    update_unit_status()