blob: 9ea2657860d1b4dafb72726703aa5f638da7e271 [file] [log] [blame]
Juha Hyttinen5f8ffa02020-02-06 15:28:59 +02001/*
2==================================================================================
3 Copyright (c) 2019 AT&T Intellectual Property.
4 Copyright (c) 2019 Nokia
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17==================================================================================
18*/
19
20package teststub
21
22import (
23 "strconv"
24)
25
26//-----------------------------------------------------------------------------
27//
28//-----------------------------------------------------------------------------
29
30type RmrRouteTable struct {
31 lines []string
32}
33
34func (rrt *RmrRouteTable) AddEntry(mtype int, src string, subid int, trg string) {
35
36 line := "mse|"
37 line += strconv.FormatInt(int64(mtype), 10)
38 if len(src) > 0 {
39 line += "," + src
40 }
41 line += "|"
42 line += strconv.FormatInt(int64(subid), 10)
43 line += "|"
44 line += trg
45 rrt.lines = append(rrt.lines, line)
46}
47
48func (rrt *RmrRouteTable) GetRt() string {
49 allrt := "newrt|start\n"
50 for _, val := range rrt.lines {
51 allrt += val + "\n"
52 }
53 allrt += "newrt|end\n"
54 return allrt
55}