diff --git a/magma/hackfest_gateway_vnfd/charms/vyos-config/src/charm.py b/magma/hackfest_gateway_vnfd/charms/vyos-config/src/charm.py index 2b9ce7d4dfdfb03455271aa1ea2a125228c91b25..a1c9df2aa3d7deefd3f105961275ad92526c857c 100755 --- a/magma/hackfest_gateway_vnfd/charms/vyos-config/src/charm.py +++ b/magma/hackfest_gateway_vnfd/charms/vyos-config/src/charm.py @@ -75,29 +75,25 @@ class SimpleHAProxyCharm(CharmBase): self.state.is_started = True # Register all of the events we want to observe - for event in ( - # Charm events - self.on.config_changed, - self.on.install, - self.on.start, - self.on.upgrade_charm, - # Charm actions (primitives) - self.on.configure_remote_action, - # OSM actions (primitives) - self.on.start_action, - self.on.stop_action, - self.on.restart_action, - self.on.reboot_action, - self.on.upgrade_action, - # SSH Proxy actions (primitives) - self.on.generate_ssh_key_action, - self.on.get_ssh_public_key_action, - self.on.run_action, - self.on.verify_ssh_credentials_action, - ): - self.framework.observe(event, self) - - self.framework.observe(self.on.proxypeer_relation_changed, self) + self.framework.observe(self.on.config_changed, self.on_config_changed) + self.framework.observe(self.on.install, self.on_install) + self.framework.observe(self.on.start, self.on_start) + self.framework.observe(self.on.upgrade_charm, self.on_upgrade_charm) + # Charm actions (primitives) + self.framework.observe(self.on.configure_remote_action, self.on_configure_remote_action) + # OSM actions (primitives) + self.framework.observe(self.on.start_action, self.on_start_action) + self.framework.observe(self.on.stop_action, self.on_stop_action) + self.framework.observe(self.on.restart_action, self.on_restart_action) + self.framework.observe(self.on.reboot_action, self.on_reboot_action) + self.framework.observe(self.on.upgrade_action, self.on_upgrade_action) + # SSH Proxy actions (primitives) + self.framework.observe(self.on.generate_ssh_key_action, self.on_generate_ssh_key_action) + self.framework.observe(self.on.get_ssh_public_key_action, self.on_get_ssh_public_key_action) + self.framework.observe(self.on.run_action, self.on_run_action) + self.framework.observe(self.on.verify_ssh_credentials_action, self.on_verify_ssh_credentials_action) + + self.framework.observe(self.on.proxypeer_relation_changed, self.on_proxypeer_relation_changed) def get_ssh_proxy(self): """Get the SSHProxy instance""" diff --git a/magma/hackfest_gateway_vnfd/charms/vyos-config/src/proxy_cluster.py b/magma/hackfest_gateway_vnfd/charms/vyos-config/src/proxy_cluster.py index 93cd119d4c92271078bf9b85fbe86eca18b415a2..bbdcb43da1255fa659120de7b23c7ac438922e45 100644 --- a/magma/hackfest_gateway_vnfd/charms/vyos-config/src/proxy_cluster.py +++ b/magma/hackfest_gateway_vnfd/charms/vyos-config/src/proxy_cluster.py @@ -24,7 +24,7 @@ class ProxyCluster(Object): self._relation_name = relation_name self._relation = self.framework.model.get_relation(self._relation_name) - self.framework.observe(charm.on.ssh_keys_initialized, self) + self.framework.observe(charm.on.ssh_keys_initialized, self.on_ssh_keys_initialized) self.state.set_default(ssh_public_key=None) self.state.set_default(ssh_private_key=None) diff --git a/magma/hackfest_magma-agw-enb_vnfd/charms/enodeb/src/charm.py b/magma/hackfest_magma-agw-enb_vnfd/charms/enodeb/src/charm.py index 8d0e453b6a7817574b18b4f999af95f7972cbc84..79d5815e7f74f590fe5ada895224657ace698859 100755 --- a/magma/hackfest_magma-agw-enb_vnfd/charms/enodeb/src/charm.py +++ b/magma/hackfest_magma-agw-enb_vnfd/charms/enodeb/src/charm.py @@ -43,19 +43,16 @@ class EnodebCharm(CharmBase): self.state.set_default(is_started=False) if not self.state.is_started: self.state.is_started = True + # Register all of the events we want to observe - for event in ( - # Charm events - self.on.config_changed, - self.on.install, - self.on.upgrade_charm, - self.on.register_action, - self.on.attach_ue_action, - self.on.unregister_action, - self.on.detach_ue_action, - self.on.remove_default_gw_action, - ): - self.framework.observe(event, self) + self.framework.observe(self.on.config_changed, self.on_config_changed) + self.framework.observe(self.on.install, self.on_install) + self.framework.observe(self.on.upgrade_charm, self.on_upgrade_charm) + self.framework.observe(self.on.register_action, self.on_register_action) + self.framework.observe(self.on.attach_ue_action, self.on_attach_ue_action) + self.framework.observe(self.on.unregister_action, self.on_unregister_action) + self.framework.observe(self.on.detach_ue_action, self.on_detach_ue_action) + self.framework.observe(self.on.remove_default_gw_action, self.on_remove_default_gw_action) def on_config_changed(self, event): """Handle changes in configuration""" diff --git a/magma/hackfest_magma-agw-enb_vnfd/charms/magmagw/src/charm.py b/magma/hackfest_magma-agw-enb_vnfd/charms/magmagw/src/charm.py index c19ba7114c9d5a0112d4df6f21f9b7fd32f49bf9..1e2e6afb88a6c9639e87c5025f0f71fdff8c2810 100755 --- a/magma/hackfest_magma-agw-enb_vnfd/charms/magmagw/src/charm.py +++ b/magma/hackfest_magma-agw-enb_vnfd/charms/magmagw/src/charm.py @@ -73,36 +73,33 @@ class SimpleHAProxyCharm(CharmBase): self.state.is_started = True # Register all of the events we want to observe - for event in ( - # Charm events - self.on.config_changed, - self.on.install, - self.on.start, - self.on.upgrade_charm, - # Charm actions (primitives) <-- MAGMA AGW - self.on.add_net_action, - self.on.add_gw_action, - self.on.reset_id_action, - self.on.add_hosts_action, - self.on.restart_magma_action, - self.on.del_gw_action, - self.on.reset_id_action, - self.on.add_test_subscriber_action, - # OSM actions (primitives) - self.on.start_action, - self.on.stop_action, - self.on.restart_action, - self.on.reboot_action, - self.on.upgrade_action, - # SSH Proxy actions (primitives) - self.on.generate_ssh_key_action, - self.on.get_ssh_public_key_action, - self.on.run_action, - self.on.verify_ssh_credentials_action, - ): - self.framework.observe(event, self) - - self.framework.observe(self.on.proxypeer_relation_changed, self) + self.framework.observe(self.on.config_changed, self.on_config_changed) + self.framework.observe(self.on.install, self.on_install) + self.framework.observe(self.on.start, self.on_start) + self.framework.observe(self.on.upgrade_charm, self.on_upgrade_charm) + # Charm actions (primitives) + self.framework.observe(self.on.add_net_action, self.on_add_net_action) + self.framework.observe(self.on.add_gw_action, self.on_add_gw_action) + self.framework.observe(self.on.reset_id_action, self.on_reset_id_action) + self.framework.observe(self.on.add_hosts_action, self.on_add_hosts_action) + self.framework.observe(self.on.restart_magma_action, self.on_restart_magma_action) + self.framework.observe(self.on.del_gw_action, self.on_del_gw_action) + self.framework.observe(self.on.reset_id_action, self.on_reset_id_action) + self.framework.observe(self.on.add_test_subscriber_action, self.on_add_test_subscriber_action) + # OSM actions (primitives) + self.framework.observe(self.on.start_action, self.on_start_action) + self.framework.observe(self.on.stop_action, self.on_stop_action) + self.framework.observe(self.on.restart_action, self.on_restart_action) + self.framework.observe(self.on.reboot_action, self.on_reboot_action) + self.framework.observe(self.on.upgrade_action, self.on_upgrade_action) + # SSH Proxy actions (primitives) + self.framework.observe(self.on.generate_ssh_key_action, self.on_generate_ssh_key_action) + self.framework.observe(self.on.get_ssh_public_key_action, self.on_get_ssh_public_key_action) + self.framework.observe(self.on.run_action, self.on_run_action) + self.framework.observe(self.on.verify_ssh_credentials_action, self.on_verify_ssh_credentials_action) + + self.framework.observe(self.on.proxypeer_relation_changed, self.on_proxypeer_relation_changed) + def get_ssh_proxy(self): """Get the SSHProxy instance""" @@ -137,7 +134,10 @@ class SimpleHAProxyCharm(CharmBase): unit.status = BlockedStatus("Invalid SSH credentials.") def on_install(self, event): - pass + unit = self.model.unit + unit.status = MaintenanceStatus("Installing all SW") + SSHProxy.install() + unit.status = ActiveStatus() def on_start(self, event): """Called when the charm is being installed""" diff --git a/magma/hackfest_magma-agw-enb_vnfd/charms/magmagw/src/proxy_cluster.py b/magma/hackfest_magma-agw-enb_vnfd/charms/magmagw/src/proxy_cluster.py index 93cd119d4c92271078bf9b85fbe86eca18b415a2..bbdcb43da1255fa659120de7b23c7ac438922e45 100644 --- a/magma/hackfest_magma-agw-enb_vnfd/charms/magmagw/src/proxy_cluster.py +++ b/magma/hackfest_magma-agw-enb_vnfd/charms/magmagw/src/proxy_cluster.py @@ -24,7 +24,7 @@ class ProxyCluster(Object): self._relation_name = relation_name self._relation = self.framework.model.get_relation(self._relation_name) - self.framework.observe(charm.on.ssh_keys_initialized, self) + self.framework.observe(charm.on.ssh_keys_initialized, self.on_ssh_keys_initialized) self.state.set_default(ssh_public_key=None) self.state.set_default(ssh_private_key=None)