blob: f035445ac1bb08aac071858399dad3ba477c4544 [file] [log] [blame]
Christopher Faulet7983b862020-10-29 16:34:22 +01001varnishtest "fix converters Test"
Christopher Faulet85a81362020-12-15 17:13:39 +01002#REQUIRE_VERSION=2.4
Christopher Faulet7983b862020-10-29 16:34:22 +01003
4feature ignore_unknown_macro
5
6server s1 {
7 # Valid FIX-4.0 logon
8 recv 92
9 # 8=FIX|4.0|9=66|35=A|34=1|49=EXECUTOR|52=20201029-10:54:19|56=CLIENT1|98=0|108=30|10=147|
10 sendhex "383d4649582e342e3001393d36360133353d410133343d310134393d4558454355544f520135323d32303230313032392d31303a35343a31390135363d434c49454e54310139383d30013130383d33300131303d31343701"
11 close
12
13 # Valid FIX-4.1 logon
14 accept
15 recv 98
16 # 8=FIX.4.1|9=72|35=A|34=1|49=EXECUTOR|52=20201029-12:43:07|56=CLIENT1|98=0|108=30|141=Y|10=187|
17 sendhex "383d4649582e342e3101393d37320133353d410133343d310134393d4558454355544f520135323d32303230313032392d31323a34333a30370135363d434c49454e54310139383d30013130383d3330013134313d590131303d31383701"
18 close
19
20 # Valid FIX-4.2 logon
21 accept
22 recv 98
23 # 8=FIX.4.2|9=79|35=A|34=1|49=EXECUTOR|52=20201029-12:55:12.101414|56=CLIENT1|98=0|108=30|141=Y|10=027|
24 sendhex "383d4649582e342e3201393d37390133353d410133343d310134393d4558454355544f520135323d32303230313032392d31323a35353a31322e3130313431340135363d434c49454e54310139383d30013130383d3330013134313d590131303d30323701"
25 close
26
27 # Valid FIX-4.3 logon
28 accept
29 recv 125
30 # 8=FIX.4.3|9=79|35=A|34=1|49=EXECUTOR|52=20201029-12:58:50.891371|56=CLIENT1|98=0|108=30|141=Y|10=051|
31 sendhex "383d4649582e342e3301393d37390133353d410133343d310134393d4558454355544f520135323d32303230313032392d31323a35383a35302e3839313337310135363d434c49454e54310139383d30013130383d3330013134313d590131303d30353101"
32 close
33
34 # Valid FIX-4.4 logon
35 accept
36 recv 125
37 # 8=FIX.4.4|9=79|35=A|34=1|49=EXECUTOR|52=20201029-13:02:44.535360|56=CLIENT1|98=0|108=30|141=Y|10=038|
38 sendhex "383d4649582e342e3401393d37390133353d410133343d310134393d4558454355544f520135323d32303230313032392d31333a30323a34342e3533353336300135363d434c49454e54310139383d30013130383d3330013134313d590131303d30333801"
39 close
40
41 # Valid FIX-5.0 logon
42 accept
43 recv 140
44 # 8=FIXT.1.1|9=86|35=A|34=1|49=EXECUTOR|52=20201029-13:13:22.626384|56=CLIENT1|98=0|108=30|141=Y|1137=7|10=184|
45 sendhex "383d464958542e312e3101393d38360133353d410133343d310134393d4558454355544f520135323d32303230313032392d31333a31333a32322e3632363338340135363d434c49454e54310139383d30013130383d3330013134313d5901313133373d370131303d31383401"
46} -start
47
48server s2 {
49 # Valid FIX-4.4 logon
50 recv 125
51 # 8=FIX.4.4|9=79|35=A|34=1|49=EXECUTOR|52=20201029-13:02:44.535360|56=CLIENT1|98=0|108=30|141=Y|10=038|
52 sendhex "383d4649582e342e3401393d37390133353d410133343d310134393d4558454355544f520135323d32303230313032392d31333a30323a34342e3533353336300135363d434c49454e54310139383d30013130383d3330013134313d590131303d30333801"
53
54} -start
55
56haproxy h1 -conf {
57 defaults
58 mode tcp
59 timeout connect 1s
60 timeout client 1s
61 timeout server 1s
62
63 frontend fe1
64 bind "fd@${fe1}"
65 tcp-request inspect-delay 1s
66 tcp-request content reject unless { req.payload(0,0),fix_is_valid }
67 default_backend be1
68
69 frontend fe2
70 bind "fd@${fe2}"
71 tcp-request inspect-delay 1s
72 tcp-request content reject unless { req.payload(0,0),fix_is_valid }
73 tcp-request content set-var(req.fix_vsn) req.payload(0,0),fix_tag_value(BeginString)
74 tcp-request content set-var(req.fix_len) req.payload(0,0),fix_tag_value(BodyLength)
75 tcp-request content set-var(req.fix_type) req.payload(0,0),fix_tag_value(MsgType)
Daniel Corbettbefef702021-03-09 23:00:34 -050076 tcp-request content set-var(req.fix_sender) req.payload(0,0),fix_tag_value(SenderCompID)
77 tcp-request content set-var(req.fix_target) req.payload(0,0),fix_tag_value(TargetCompID)
Christopher Faulet7983b862020-10-29 16:34:22 +010078 tcp-request content set-var(req.fix_chksum) req.payload(0,0),fix_tag_value(CheckSum)
79 tcp-request content reject if ! { var(req.fix_vsn) "FIX.4.4" } || ! { var(req.fix_len) "102" }
80 tcp-request content reject if ! { var(req.fix_type) "A" } || ! { var(req.fix_sender) "CLIENT1" }
81 tcp-request content reject if ! { var(req.fix_target) "EXECUTOR" } || ! { var(req.fix_chksum) "252" }
82 default_backend be2
83
84 backend be1
85 server s1 ${s1_addr}:${s1_port}
86 tcp-response inspect-delay 1s
87 tcp-response content reject unless { res.payload(0,0),fix_is_valid }
88
89 backend be2
90 server s2 ${s2_addr}:${s2_port}
91 tcp-response inspect-delay 1s
92 tcp-response content reject unless { res.payload(0,0),fix_is_valid }
93 tcp-response content set-var(res.fix_vsn) res.payload(0,0),fix_tag_value(8)
94 tcp-response content set-var(res.fix_len) res.payload(0,0),fix_tag_value(9)
95 tcp-response content set-var(res.fix_type) res.payload(0,0),fix_tag_value(35)
96 tcp-response content set-var(res.fix_sender) res.payload(0,0),fix_tag_value(49)
97 tcp-response content set-var(res.fix_target) res.payload(0,0),fix_tag_value(56)
98 tcp-response content set-var(res.fix_chksum) res.payload(0,0),fix_tag_value(10)
99 tcp-response content reject if ! { var(res.fix_vsn) "FIX.4.4" } || ! { var(res.fix_len) "79" }
100 tcp-response content reject if ! { var(res.fix_type) "A" } || ! { var(res.fix_sender) "EXECUTOR" }
101 tcp-response content reject if ! { var(res.fix_target) "CLIENT1" } || ! { var(res.fix_chksum) eq "038" }
102} -start
103
104client c1_4_0 -connect ${h1_fe1_sock} {
105 # Valid FIX-4.0 logon
106 # 8=FIX|4.0|9=70|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-10:54:19.617|98=0|108=30|10=090|
107 sendhex "383d4649582e342e3001393d37300133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31303a35343a31392e3631370139383d30013130383d33300131303d30393001"
108 recv 88
109 expect_close
110} -run
111
112client c1_4_1 -connect ${h1_fe1_sock} {
113 # Valid FIX-4.1 logon
114 # 8=FIX.4.1|9=76|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-12:43:07.940|98=0|108=30|141=Y|10=138|
115 sendhex "383d4649582e342e3101393d37360133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31323a34333a30372e3934300139383d30013130383d3330013134313d590131303d31333801"
116 recv 94
117 expect_close
118} -run
119
120client c1_4_2 -connect ${h1_fe1_sock} {
121 # Valid FIX-4.2 logon
122 # 8=FIX.4.2|9=76|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-12:55:12.100|98=0|108=30|141=Y|10=126|
123 sendhex "383d4649582e342e3201393d37360133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31323a35353a31322e3130300139383d30013130383d3330013134313d590131303d31323601"
124 recv 101
125 expect_close
126} -run
127
128client c1_4_3 -connect ${h1_fe1_sock} {
129 # Valid FIX-4.3 logon
130 # 8=FIX.4.3|9=102|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-12:58:50.889|98=0|108=30|141=Y|553=Username|554=Password|10=012|
131 sendhex "383d4649582e342e3301393d3130320133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31323a35383a35302e3838390139383d30013130383d3330013134313d59013535333d557365726e616d65013535343d50617373776f72640131303d30313201"
132 recv 101
133 expect_close
134} -run
135
136client c1_4_4 -connect ${h1_fe1_sock} {
137 # Valid FIX-4.4 logon
138 # 8=FIX.4.4|9=102|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-13:02:44.528|98=0|108=30|141=Y|553=Username|554=Password|10=252|
139 sendhex "383d4649582e342e3401393d3130320133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31333a30323a34342e3532380139383d30013130383d3330013134313d59013535333d557365726e616d65013535343d50617373776f72640131303d32353201"
140 recv 101
141 expect_close
142} -run
143
144client c1_5_0 -connect ${h1_fe1_sock} {
145 # Valid FIX-5.0 logon
146 # 8=FIXT.1.1|9=116|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-13:13:22.624|1128=7|98=0|108=30|141=Y|553=Username|554=Password|1137=7|10=204|
147 sendhex "383d464958542e312e3101393d3131360133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31333a31333a32322e36323401313132383d370139383d30013130383d3330013134313d59013535333d557365726e616d65013535343d50617373776f726401313133373d370131303d32303401"
148 recv 109
149 expect_close
150} -run
151
152client c2_1 -connect ${h1_fe1_sock} {
153 # InValid FIX-4.4: Empty TagName (missing EncryptMethod <98> tag name)
154 # 8=FIX.4.4|9=100|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-13:02:44.528|=0|108=30|141=Y|553=Username|554=Password|10=252|
155 sendhex "383d4649582e342e3401393d3130300133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31333a30323a34342e353238013d30013130383d3330013134313d59013535333d557365726e616d65013535343d50617373776f72640131303d32353201"
156 expect_close
157} -run
158
159client c2_2 -connect ${h1_fe1_sock} {
160 # InValid FIX-4.4: Empty TagValue (missing EncryptMethod <98> tag value)
161 # 8=FIX.4.4|9=101|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-13:02:44.528|98=|108=30|141=Y|553=Username|554=Password|10=252|
162 sendhex "383d4649582e342e3401393d3130310133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31333a30323a34342e3532380139383d013130383d3330013134313d59013535333d557365726e616d65013535343d50617373776f72640131303d32353201"
163 expect_close
164} -run
165
166client c2_3 -connect ${h1_fe1_sock} {
167 # InValid FIX-4.4: Empty Tag no delimiter (missing delimiter for EncryptMethod <98> tag)
168 # 8=FIX.4.4|9=101|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-13:02:44.528|98|108=30|141=Y|553=Username|554=Password|10=252|
169 sendhex "383d4649582e342e3401393d3130300133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31333a30323a34342e353238013938013130383d3330013134313d59013535333d557365726e616d65013535343d50617373776f72640131303d32353201"
170 expect_close
171} -run
172
173client c2_4 -connect ${h1_fe1_sock} {
174 # Invalid FIX-4.4: First tag != BeginString
175 # 9=102|8=FIX.4.4|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-13:02:44.528|98=0|108=30|141=Y|553=Username|554=Password|10=252|
176 sendhex "393d31303201383d4649582e342e340133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31333a30323a34342e3532380139383d30013130383d3330013134313d59013535333d557365726e616d65013535343d50617373776f72640131303d32353201"
177 expect_close
178} -run
179
180client c2_5 -connect ${h1_fe1_sock} {
181 # Invalid FIX-4.4: Second tag != BodyLength
182 # 8=FIX.4.4|35=A|9=102|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-13:02:44.528|98=0|108=30|141=Y|553=Username|554=Password|10=252|
183 sendhex "383d4649582e342e340133353d4101393d3130320134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31333a30323a34342e3532380139383d30013130383d3330013134313d59013535333d557365726e616d65013535343d50617373776f72640131303d32353201"
184 expect_close
185} -run
186
187client c2_6 -connect ${h1_fe1_sock} {
188 # Invalid FIX-4.4: Third tag != MsgType
189 # 8=FIX.4.4|9=102|49=CLIENT1|35=A|56=EXECUTOR|34=1|52=20201029-13:02:44.528|98=0|108=30|141=Y|553=Username|554=Password|10=252|
190 sendhex "383d4649582e342e3401393d3130320134393d434c49454e54310133353d410135363d4558454355544f520133343d310135323d32303230313032392d31333a30323a34342e3532380139383d30013130383d3330013134313d59013535333d557365726e616d65013535343d50617373776f72640131303d32353201"
191 expect_close
192} -run
193
194client c2_7 -connect ${h1_fe1_sock} {
195 # Invalid FIX-4.4: Bad body length (too short 100 != 102)
196 # 8=FIX.4.4|9=100|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-13:02:44.528|98=0|108=30|141=Y|553=Username|554=Password|10=252|
197 sendhex "383d4649582e342e3401393d3130300133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31333a30323a34342e3532380139383d30013130383d3330013134313d59013535333d557365726e616d65013535343d50617373776f72640131303d32353201"
198 expect_close
199} -run
200
201client c2_8 -connect ${h1_fe1_sock} {
202 # Invalid FIX-4.4: Bad body length (too long 105 != 102)
203 # 8=FIX.4.4|9=105|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-13:02:44.528|98=0|108=30|141=Y|553=Username|554=Password|10=252|XXX
204 sendhex "383d4649582e342e3401393d3130350133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31333a30323a34342e3532380139383d30013130383d3330013134313d59013535333d557365726e616d65013535343d50617373776f72640131303d32353201585858"
205 expect_close
206} -run
207
208client c2_9 -connect ${h1_fe1_sock} {
209 # Invalid FIX-4.4: Too short checksum value (< 3 digit)
210 # 8=FIX.4.4|9=102|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-13:02:44.528|98=0|108=30|141=Y|553=Username|554=Password|10=25|
211 sendhex "383d4649582e342e3401393d3130320133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31333a30323a34342e3532380139383d30013130383d3330013134313d59013535333d557365726e616d65013535343d50617373776f72640131303d323501"
212 expect_close
213} -run
214
215client c2_10 -connect ${h1_fe1_sock} {
216 # Invalid FIX-4.4: Too long checksum value (> 3 digit)
217 # 8=FIX.4.4|9=102|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-13:02:44.528|98=0|108=30|141=Y|553=Username|554=Password|10=2520|
218 sendhex "383d4649582e342e3401393d3130320133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31333a30323a34342e3532380139383d30013130383d3330013134313d59013535333d557365726e616d65013535343d50617373776f72640131303d3235323001"
219 expect_close
220} -run
221
222client c2_11 -connect ${h1_fe1_sock} {
223 # Invalid FIX-4.4: invalid checksum value (253 != 252)
224 # 8=FIX.4.4|9=102|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-13:02:44.528|98=0|108=30|141=Y|553=Username|554=Password|10=253|
225 sendhex "383d4649582e342e3401393d3130320133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31333a30323a34342e3532380139383d30013130383d3330013134313d59013535333d557365726e616d65013535343d50617373776f72640131303d32353301"
226 expect_close
227} -run
228
229
230client c3_1 -connect ${h1_fe2_sock} {
231 # 8=FIX.4.4|9=102|35=A|49=CLIENT1|56=EXECUTOR|34=1|52=20201029-13:02:44.528|98=0|108=30|141=Y|553=Username|554=Password|10=252|
232 sendhex "383d4649582e342e3401393d3130320133353d410134393d434c49454e54310135363d4558454355544f520133343d310135323d32303230313032392d31333a30323a34342e3532380139383d30013130383d3330013134313d59013535333d557365726e616d65013535343d50617373776f72640131303d32353201"
233 recv 101
234 expect_close
235} -run