Check and Correct TestEran_Port function used for port() testing
```func TestEran_Port(t *testing.T) {
	cases := []struct {
		subNetwork string
		nodes      map[string]map[string]map[string]map[string]string
		name       string
		tnPort     string
		tnPort2    string
	}{
		{
			subNetwork: "Shymkent",
			nodes:      map[string]map[string]map[string]map[string]string{
				"ERBS_41001_BCUKGU_2_KKT": {
					"EUtranCellData": {
						"CellsGroups": {
							"Kcell": "41511A1L-D4L",
						},
					},
				},
			},
			name:       "ERBS_41001_BCUKGU_1_KKT",
			tnPort:     "TN_IDL_D",
			tnPort2:    "",
		},
		{
			subNetwork: "Shymkent",
			nodes:      map[string]map[string]map[string]map[string]string{
				"GRBS_41001_BCUKGU_1_KKT": {
					"EUtranCellData": {
						"CellsGroups": {
							"Kcell": "41511A1L-D4L",
						},
					},
				},
			},
			name:       "ERBS_41001_BCUKGU_1_KKT",
			tnPort:     "TN_IDL_C",
			tnPort2:    "",
		},
		{
			subNetwork: "Shymkent",
			nodes:      map[string]map[string]map[string]map[string]string{
				"ERBS_41001_BCUKGU_1_KKT": {
					"EUtranCellData": {
						"CellsGroups": {
							"Kcell": "41511A1L-D4L",
						},
					},
				},
			},
			name:       "GRBS_41001_BCUKGU_1_KKT",
			tnPort:     "TN_IDL_C",
			tnPort2:    "",
		},
		{
			subNetwork: "Almaty",
			nodes:      map[string]map[string]map[string]map[string]string{
				"ERBS_01001_BCUKGU_1_KKT": {
					"EUtranCellData": {
						"CellsGroups": {
							"Kcell": "41511A1L-D4L",
						},
					},
				},
			},
			name:       "GRBS_01001_BCUKGU_1_KKT",
			tnPort:     "TN_IDL_C",
			tnPort2:    "",
		},
		{
			subNetwork: "Almaty",
			nodes:      map[string]map[string]map[string]map[string]string{
				"GRBS_01001_BCUKGU_1_KKT": {
					"EUtranCellData": {
						"CellsGroups": {
							"Kcell": "41511A1L-D4L",
						},
					},
				},
			},
			name:       "ERBS_01001_BCUKGU_1_KKT",
			tnPort:     "TN_A",
			tnPort2:    "",
		},
		{
			subNetwork: "Almaty",
			nodes:      map[string]map[string]map[string]map[string]string{
				"ERBS_01001_BCUKGU_2_KKT": {
					"EUtranCellData": {
						"CellsGroups": {
							"Kcell": "41511A1L-D4L",
						},
					},
				},
			},
			name:       "ERBS_01001_BCUKGU_1_KKT",
			tnPort:     "TN_B",
			tnPort2:    "",
		},
		{
			subNetwork: "Shymkent",
			nodes:      map[string]map[string]map[string]map[string]string{
				"ERBS_41001_BCUKGU_1_KKT": {
					"EUtranCellData": {
						"CellsGroups": {
							"Kcell": "41511A1L-D4L",
						},
					},
				},
				"ERBS_41001_BCUKGU_2_KKT": {
					"EUtranCellData": {
						"CellsGroups": {
							"Kcell": "41511A1L-D4L",
						},
					},
				},
			},
			name:       "GRBS_01001_BCUKGU_1_KKT",
			tnPort:     "TN_IDL_C",
			tnPort2:    "TN_IDL_D",
		},
		{
			subNetwork: "Shymkent",
			nodes:      map[string]map[string]map[string]map[string]string{
				"GRBS_41001_BCUKGU_1_KKT": {
					"EUtranCellData": {
						"CellsGroups": {
							"Kcell": "41511A1L-D4L",
						},
					},
				},
				"ERBS_41001_BCUKGU_1_KKT": {
					"EUtranCellData": {
						"CellsGroups": {
							"Kcell": "41511A1L-D4L",
						},
					},
				},
			},
			name:       "ERBS_41001_BCUKGU_2_KKT",
			tnPort:     "TN_IDL_D",
			tnPort2:    "TN_IDL_C",
		},
		{
			subNetwork: "Almaty",
			nodes:      map[string]map[string]map[string]map[string]string{
				"GRBS_01001_BCUKGU_1_KKT": {
					"EUtranCellData": {
						"CellsGroups": {
							"Kcell": "41511A1L-D4L",
						},
					},
				},
				"ERBS_01001_BCUKGU_2_KKT": {
					"EUtranCellData": {
						"CellsGroups": {
							"Kcell": "41511A1L-D4L",
						},
					},
				},
			},
			name:       "ERBS_01001_BCUKGU_1_KKT",
			tnPort:     "TN_B",
			tnPort2:    "TN_A",
		},
		{
			subNetwork: "Almaty",
			nodes:      map[string]map[string]map[string]map[string]string{
				"ERBS_401001_BCUKGU_1_KKT": {
					"EUtranCellData": {
						"CellsGroups": {
							"Kcell": "41511A1L-D4L",
						},
					},
				},
				"ERBS_01001_BCUKGU_2_KKT": {
					"EUtranCellData": {
						"CellsGroups": {
							"Kcell": "41511A1L-D4L",
						},
					},
				},
			},
			name:       "GRBS_01001_BCUKGU_1_KKT",
			tnPort:     "TN_IDL_C",
			tnPort2:    "TN_IDL_D",
		},
	}

	for _, c := range cases {
		testName := fmt.Sprintf("[%s] %s", c.subNetwork, c.name)
		t.Run(testName, func(t *testing.T) {
			elasticran := EranConnection{
				SubNetwork: SubNetwork{
					Name: c.subNetwork,
				},
				ENodeB: ENodeB{
					Site: Site{
						Cellular: Cellular{
							Name: c.name,
						},
					},
				},
				// Nodes: Nodes(c.nodes),
			}

			elasticran.port()

			if elasticran.TnPort != c.tnPort {
				t.Errorf("[%s] Expected TnPort to be %s, but got %s", testName, c.tnPort, elasticran.TnPort)
			}

			if elasticran.TnPort2 != c.tnPort2 {
				t.Errorf("[%s] Expected TnPort2 to be %s, but got %s", testName, c.tnPort2, elasticran.TnPort2)
			}
		})
	}
}
package model

import (
	"fmt"
	"strings"

	validation "github.com/go-ozzo/ozzo-validation/v4"
)

// EranConnection is custom type that represents Elastic Ran connection instance
// used within the node of Radio Access Network
type EranConnection struct {
	Vlan
	SubNetwork  `json:"subNetwork"`
	ENodeB      `json:"parent"`
	Connection  string
	Connections []string
	TnPort      string
	TnPort2     string
	TnPorts     []string
	Bridges []string
	Bridge     string
	Nodes       `json:"children"`
}
// connection initiates EranConnection default BBU connection type
func (elasticran *EranConnection) port() {
	name := elasticran.ENodeB.Cellular.Name
	subNetwork := elasticran.SubNetwork.Name
	nodes := elasticran.Nodes
	
	if nodes.Count() == 1 {
		nodesname := nodes.Names()
		elasticran.TnPort2 = ""
		if strings.HasPrefix(name, "GRBS") {
			elasticran.TnPort = "TN_IDL_C"
		} else if strings.HasPrefix(name, "ERBS") && strings.Contains(name, "_1_") && strings.HasPrefix(nodesname[0], "GRBS") {
			if subNetwork == "Shymkent" {
				elasticran.TnPort = "TN_IDL_C"
			} else {
				elasticran.TnPort = "TN_A"
			}
		} else if strings.HasPrefix(name, "ERBS") && strings.Contains(name, "_1_") {
			if subNetwork == "Shymkent" {
				elasticran.TnPort = "TN_IDL_D"
			} else {
				elasticran.TnPort = "TN_B"
			}
		} else if strings.HasPrefix(name, "ERBS") && strings.Contains(name, "_2_") {
			if subNetwork == "Shymkent" {
				elasticran.TnPort = "TN_IDL_C"
			} else {
				elasticran.TnPort = "TN_A"
			}
		}
	} else if nodes.Count() == 2 {
		if strings.HasPrefix(name, "GRBS") {
			elasticran.TnPort = "TN_IDL_C"
			elasticran.TnPort2 = "TN_IDL_D"
		} else if strings.HasPrefix(name, "ERBS") {
			if subNetwork == "Shymkent" {
				elasticran.TnPort = "TN_IDL_D"
				elasticran.TnPort2 = "TN_IDL_C"
			} else {
				elasticran.TnPort = "TN_B"
				elasticran.TnPort2 = "TN_A"
			}
		}
	}
}```