Search code examples
plantuml

Network diagram in PlantUML not working as expected?


I am trying to create a network diagram for my office using PlantUML. I am stuck very early on. I am beginning at the edge of our network and working downwards. I would like to use the sprites as much as possible.

I have

@startuml
!include <office/Servers/application_server>
!include <office/Devices/router>

nwdiag {
  internet [shape = cloud];
  router [description="<$router>\nRouter"];
  internet -- router;
  
}
@enduml

which shows enter image description here which is not using the sprite I asked for. If I rename the router in the connection like so -

@startuml
!include <office/Servers/application_server>
!include <office/Devices/router>

nwdiag {
  internet [shape = cloud];
  router [description="<$router>\nRouter"];
  internet -- router2;
  
}
@enduml

I do see my sprite though obviously it's not in the right place.

enter image description here

I do not see what I am doing wrong. How I can I connect the internet to the object called router which has the sprite attached?


Solution

  • This is one of those quirky things about ordering in PlantUML (not very logical). But I put the link line before the sprite line, and it works.

    @startuml
    !include <office/Servers/application_server>
    !include <office/Devices/router>
    
    nwdiag {
      internet [shape = cloud];
      internet -- router;
      router [description="<$router>\nRouter"];
      
    }
    @enduml
    

    enter image description here