Пример #1
0
def main(host, port, redis_address, service_id):

    bash_deployer = BashDeployer(None)
    configurer = CNSMOManager(redis_address, service_id, "VPNClient", bash_deployer, None)
    configurer.start()
    configurer.compose_service(**get_app_request(host, port, service_id))
    configurer.launch_service(service_id)
Пример #2
0
 def deploy_service():
     service_manager = CNSMOManager(redis_address, service_name,
                                    service_type, deployer, None)
     service_manager.start()
     service_manager.compose_service(**request)
     service_manager.launch_service(service_name)
     return service_manager
Пример #3
0
def main(host, port, redis_address, service_id):

    bash_deployer = BashDeployer(None)
    server = CNSMOManager(redis_address, service_id, "FWServer", bash_deployer, None)
    server.start()
    time.sleep(0.5)
    server.compose_service(**get_server_app_request(host, port, service_id))
    server.launch_service(service_id)
Пример #4
0
def launch_configurator(host, port, redis_address, service_id, lb_address, lb_port, lb_mode, lb_backend_servers):

    bash_deployer = BashDeployer(None)
    configurer = CNSMOManager(redis_address, service_id, "LBConfigManager", bash_deployer, None)
    configurer.start()
    configurer.compose_service(**get_app_request(host, port, service_id, lb_address, lb_port, lb_mode, lb_backend_servers))
    configurer.launch_service(service_id)
Пример #5
0
    def deploy_service(self, redis_address, service_name, service_type, deployer, request):
        service_manager = CNSMOManager(redis_address, service_name, service_type, deployer, None)
        service_manager.start()
        service_manager.compose_service(**request)
        service_manager.launch_service(service_name)

        return service_manager
Пример #6
0
def main():

    bash_deployer = BashDeployer(None)
    configurer = CNSMOManager("localhost:6379", "client", "ClientVPN",
                              bash_deployer, None)
    configurer.start()
    configurer.compose_service(**get_app_request())
    configurer.launch_service("ClientVPN")

    while True:
        time.sleep(1)
Пример #7
0
def main():

    bash_deployer = BashDeployer(None)
    server = CNSMOManager("localhost:6379", "server", "VPNServer", bash_deployer, None)
    server.start()
    time.sleep(0.5)
    server.compose_service(**get_server_app_request())
    server.launch_service("VPNServerService")

    while True:
        time.sleep(1)
Пример #8
0
def launch_configurator(host, port, redis_address, service_id, lb_address,
                        lb_port, lb_mode, lb_backend_servers):

    bash_deployer = BashDeployer(None)
    configurer = CNSMOManager(redis_address, service_id, "LBConfigManager",
                              bash_deployer, None)
    configurer.start()
    configurer.compose_service(
        **get_app_request(host, port, service_id, lb_address, lb_port, lb_mode,
                          lb_backend_servers))
    configurer.launch_service(service_id)
Пример #9
0
def launch_server(host, port, redis_address, service_id, lb_port):

    bash_deployer = BashDeployer(None)
    server = CNSMOManager(redis_address, service_id, "LBServer", bash_deployer, None)
    server.start()
    time.sleep(0.5)
    server.compose_service(**get_server_app_request(host, port, service_id, lb_port))
    server.launch_service(service_id)
Пример #10
0
def main():

    bash_deployer = BashDeployer(None)
    configurer = CNSMOManager("localhost:6379", "client", "ClientVPN", bash_deployer, None)
    configurer.start()
    configurer.compose_service(**get_app_request())
    configurer.launch_service("ClientVPN")

    while True:
        time.sleep(1)
Пример #11
0
def main():
    """
    This i a basic proof of concept of the CYCLONE CNSMO architecture
    The idea is the following:
    :We have a system state, which is representedby this main() and the mocked System state class.
    :We also have the VPN Manager which is a kind of orchestrator for different services
    :the credentialManager service represents the entity that will provide the config files and stuff
    :The Server is meant to be the service that will deploy the VPN server daemon

    the credential and server services are both configured with a basic bash deployer. That means
    that any launched app in that service, will be spawned via bash.
    For simplicity this PoC just launches to python REST servers that only respond with dummy responses.
    :return:
    """
    #Configuring basic stuff
    system_state = SystemState()
    #Just configureing the mocked system state (None arguments represents the systemstate argument)
    bash_deployer = BashDeployer(None)

    #VPN manager example, configured with the mocked system state
    vpn_manager = VPNManager(None, system_state)

    #This is a simulation. It represents that this is a distributed system
    #The service Server is spawned at some place
    server = CNSMOManager(None, "Server","server", bash_deployer, None)
    #The service Credential is spawned at another place
    credential = CNSMOManager(None, "CredentialManager", "cert", bash_deployer, None)

    #The system launches an APP to the server service (which is the python server app)
    server.launch_app(**get_server_app_request())
    #Same here but with another app
    credential.launch_app(**get_cert_app_request())

    #We sleep here in order to let the servers spawn correctly, in therry there should be callbacks or something
    import time
    time.sleep(0.5)

    #Now since we are some kind of system state, we report to the VPN Manager that the services, Server and
    #Credential Manager just were ready to use
    vpn_manager.register_service("Server")
    vpn_manager.register_service("CredentialManager")


    #We start the VPN manager here to avoid concurrency problems but it could be started at the beginig
    vpn_manager.start()
Пример #12
0
def main():
    """
    This is the second proof of concept of the CYCLONE CNSMO architecture
    The idea is the following:
    :We have a distributed  system state, which is actually implmemented.
    :We also have the VPN Manager which is a kind of orchestrator for different services
    :the credentialManager service represents the entity that will provide the config files and stuff
    :The Server is meant to be the service that will deploy the VPN server daemon

    the credential and server services are both configured with a basic bash deployer. That means
    that any launched app in that service, will be spawned via bash.
    For simplicity this PoC just launches to python REST servers that only respond with dummy responses.
    :return:
    """
    #Configuring the System State Manager, it listen to new services
    system_state = SystemStateFactory.generate_system_state_manager(
        "localhost:6379")
    t = threading.Thread(target=system_state.start)
    t.start()
    time.sleep(1)  #Sleeping for synchronization

    #The bash deployer to be used by the Server and the credential manager
    bash_deployer = BashDeployer(None)

    #Configuring the VPN Orchestrator in a different Thread to make things feel real
    vpn = VPNManager("localhost:6379")
    t2 = threading.Thread(target=vpn.start)
    t2.start()
    time.sleep(1)  #Sleeping for synch

    #At this point the VPN Manager is advertising himself to the SystemState,
    #There is a Main topic called Discovery.
    #By default the VPN Orchestrator is susbcribed to Client, Server and Credential MAnager Topics

    #Configuring the Server Manager
    server = CNSMOManager("localhost:6379", "server_123", "Server",
                          bash_deployer, None)

    #Configuring the Credential Manager
    credential = CNSMOManager("localhost:6379", "cert_123",
                              "CredentialManager", bash_deployer, None)

    #Launching the server in another thread to make things feel real
    t3 = threading.Thread(target=server.start)
    t3.start()
    time.sleep(1)

    #Launching the credential manager in a different thread to make things feel real
    t4 = threading.Thread(target=credential.start)
    t4.start()
    time.sleep(1)

    #Now we simulate that we are composing a server service for the ServerManager
    server.compose_service(**get_server_app_request().dictionarize())
    #...And launch it
    server.launch_service("server_123")
    time.sleep(
        0.5
    )  # Again, for synch, this is just to help to read the logs in the correct order

    #Let's compose a service for the credential manager as well
    credential.compose_service(**get_cert_app_request().dictionarize())
    #...And of course, launch it
    credential.launch_service("cert_123")

    #We sleep here in order to let the servers spawn correctly...
    time.sleep(0.5)
    #to finally deploy the VPN...
    vpn.deploy()
Пример #13
0
def main():
    """
    This is the second proof of concept of the CYCLONE CNSMO architecture
    The idea is the following:
    :We have a distributed  system state, which is actually implmemented.
    :We also have the VPN Manager which is a kind of orchestrator for different services
    :the credentialManager service represents the entity that will provide the config files and stuff
    :The Server is meant to be the service that will deploy the VPN server daemon

    the credential and server services are both configured with a basic bash deployer. That means
    that any launched app in that service, will be spawned via bash.
    For simplicity this PoC just launches to python REST servers that only respond with dummy responses.
    :return:
    """
    #Configuring the System State Manager, it listen to new services
    system_state = SystemStateFactory.generate_system_state_manager("localhost:6379")
    t = threading.Thread(target=system_state.start)
    t.start()
    time.sleep(1) #Sleeping for synchronization

    #The bash deployer to be used by the Server and the credential manager
    bash_deployer = BashDeployer(None)

    #Configuring the VPN Orchestrator in a different Thread to make things feel real
    vpn = VPNManager("localhost:6379")
    t2 = threading.Thread(target=vpn.start)
    t2.start()
    time.sleep(1) #Sleeping for synch

    #At this point the VPN Manager is advertising himself to the SystemState,
    #There is a Main topic called Discovery.
    #By default the VPN Orchestrator is susbcribed to Client, Server and Credential MAnager Topics


    #Configuring the Server Manager
    server = CNSMOManager("localhost:6379", "server_123", "Server", bash_deployer, None)

    #Configuring the Credential Manager
    credential = CNSMOManager("localhost:6379", "cert_123", "CredentialManager", bash_deployer, None)

    #Launching the server in another thread to make things feel real
    t3 = threading.Thread(target=server.start)
    t3.start()
    time.sleep(1)

    #Launching the credential manager in a different thread to make things feel real
    t4 = threading.Thread(target=credential.start)
    t4.start()
    time.sleep(1)

    #Now we simulate that we are composing a server service for the ServerManager
    server.compose_service(**get_server_app_request().dictionarize())
    #...And launch it
    server.launch_service("server_123")
    time.sleep(0.5)# Again, for synch, this is just to help to read the logs in the correct order


    #Let's compose a service for the credential manager as well
    credential.compose_service(**get_cert_app_request().dictionarize())
    #...And of course, launch it
    credential.launch_service("cert_123")

    #We sleep here in order to let the servers spawn correctly...
    time.sleep(0.5)
    #to finally deploy the VPN...
    vpn.deploy()