Manage the network with a state machine