Unfortunately I am not able to connect node Client1 to port 13. My unsuccessful attempt is shown below. I know that unlike nodes, pics cannot be referenced later. Can someone help me convert port/.pic to a node that can be referenced later? The red circles in my example are for guidance only.
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc, shadings, shadows, shapes.arrows}
\usetikzlibrary{positioning}
\tikzset{
port/.pic={% style, size, label
\tikzset{port/.cd,#1}
\coordinate[] (main) at (0cm,0cm);
\coordinate[] (labelposition) at (.5cm,1.2cm);
\draw[port/rect] (main) rectangle (\pgfkeysvalueof{/tikz/port/tr});
\draw[fill=black] (.1cm,0cm) rectangle (.9cm,.5cm);
\draw[fill=black] (.2cm,.5cm) rectangle (.8cm,.7cm);
\draw[fill=black] (.4cm,.7cm) rectangle (.6cm,.8cm);
\node (labelnode) at (labelposition)
{\pgfkeysvalueof{/tikz/port/label}};
},
port/.cd,
rect/.style={thin, fill=gray!20},
tr/.initial={1cm,1.5cm},
label/.initial={},
name/.initial={},
/tikz/.cd,
rack switch/.style={
name=#1,
fill=white, draw,
minimum width=20cm,
minimum height=4cm,
path picture={
\draw[top color=gray!5,bottom color=gray!40](path picture bounding box.south west) rectangle (path picture bounding box.north east);
%
\coordinate (A-west) at([xshift=1cm,yshift=.2]path picture bounding box.west);
%
\draw[rack switch/point] (A-west) circle ;
%
\coordinate (A-center) at ($(path picture bounding box.center)!0!(path picture bounding box.south)$);
%
\draw[rack switch/point] (A-center) circle;
%
\coordinate (A-east) at (path picture bounding box.east);
%
\draw[rack switch/point] (A-east) circle;
%
\foreach \x/\a in {0/1,1.2/2,2.4/3,3.6/4,4.8/5,6/7,7.2/8,8.4/9,9.6/10,10.8/11, 12/12, 13.2/13}{
\pic(\a) at ($(A-west)+(\x,0cm)$){port={label=\a}};
}
\foreach \x/\b in {1/14,2.2/15,3.4/16, 4.6/17, 5.8/18, 7/19, 8.2/20, 9.4/21, 10.6/22, 11.8/23, 13/24, 14.2/25}{
\picrotate=180 at ($(A-west)+(\x,-.2cm)$){port={label=\b}};
}
}
},
rack switch/.cd,
point/.style={fill=red!50, radius=0.2cm},
/tikz/.cd
}
\begin{document}
\begin{tikzpicture}
\node(Switch1) at (0,0) [rack switch=s]{};
\node(Client1) [above right=2of s] {\includegraphics{icons/fileserver}};
\draw [red, ->] (Client1) -- (13);
\end{tikzpicture}
\end{document}


nodeinside apicwith several parameters; one of them is name of node. So you can refer later the name of thenodeas if the name of thepic. See an example here https://tex.stackexchange.com/a/602058/140722 – Black Mild Aug 03 '21 at 06:04