opensaf  5.21.09
About: OpenSAF is a project focused on Service Availability (SA) that develops middleware based on open and industry standard interfaces for applications requiring uninterrupted 24x7 service.
  Fossies Dox: opensaf-5.21.09.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

mdstipc_api.c
Go to the documentation of this file.
1/* OpenSAF
2 *
3 * (C) Copyright 2008 The OpenSAF Foundation
4 * Copyright Ericsson AB 2017 - All Rights Reserved.
5 *
6 * This program is distributed in the hope that it will be useful, but
7 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
8 * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed
9 * under the GNU Lesser General Public License Version 2.1, February 1999.
10 * The complete license can be accessed from the following location:
11 * http://opensource.org/licenses/lgpl-license.php
12 * See the Copying file included with the OpenSAF distribution for full
13 * licensing terms.
14 *
15 * Author(s): Ericsson AB
16 *
17 */
18
19/* The test framework */
20#include "osaf/apitest/utest.h"
21#include "osaf/apitest/util.h"
22
23#include <stdio.h>
24#include <stdlib.h>
25#include "mds/mds_papi.h"
26#include "base/ncs_mda_papi.h"
27#include "base/ncs_main_papi.h"
28#include "mdstipc.h"
29#include "base/ncssysf_tmr.h"
30#include "base/osaf_poll.h"
31#include "base/osaf_time.h"
32
33#define MSG_SIZE MDS_DIRECT_BUF_MAXSIZE
36
37MDS_SVC_ID svc_ids[3] = {2006, 2007, 2008};
38
39pthread_mutex_t safe_printf_mutex = PTHREAD_MUTEX_INITIALIZER;
40pthread_mutex_t gl_mutex = PTHREAD_MUTEX_INITIALIZER;
41
42void safe_printf(const char* format, ... ) {
43 pthread_mutex_lock(&safe_printf_mutex);
44 va_list args;
45 va_start(args, format);
46 vfprintf(stdout, format, args);
47 va_end(args);
48 pthread_mutex_unlock(&safe_printf_mutex);
49}
50int safe_fflush(FILE *stream) {
51 int rc = 0;
52 pthread_mutex_lock(&safe_printf_mutex);
53 rc = fflush(stream);
54 pthread_mutex_unlock(&safe_printf_mutex);
55 return rc;
56}
57
58#define printf safe_printf
59#define fflush safe_fflush
60
61/*****************************************************************************/
62/************ SERVICE API TEST CASES ********************************/
63/*****************************************************************************/
65{
66 printf(" Inside Thread\n");
68 gl_tet_vdest[0].mds_pwe1_hdl, NCSMDS_SVC_ID_EXTERNAL_MIN, 1,
69 NCSMDS_SCOPE_NONE, true, false) != NCSCC_RC_SUCCESS) {
70 printf("Install Failed");
71 }
72}
73
75{
76 int FAIL = 0;
77 // Creating a MxN VDEST with id = 2000
79 printf(
80 "\nERROR: Fail to Creating a MxN VDEST with id = 2000\n");
81 FAIL = 1;
82 }
83
84 printf("\nTest case 1: Installing service 500 twice\n");
85 // Installing the service 500
86 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, 500, 1,
88 false) != NCSCC_RC_SUCCESS) {
89 printf("\nFail to Installing the service 500\n");
90 }
91
92 // Installing the service 500 again.
93 // It shall not possible to install the ALREADY installed service 500
94 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, 500, 1,
96 false) != NCSCC_RC_FAILURE) {
97 printf(
98 "\npossible to install the ALREADY installed service 500\n");
99 FAIL = 1;
100 }
101
102 // printf("\nUninstalling the above service\n");
103 if (mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl, 500) !=
105 printf("\nFail to Uninstalling the above service\n");
106 FAIL = 1;
107 }
108
109 // Destroying a MxN VDEST with id = 2000
110 if (destroy_vdest(2000) != NCSCC_RC_SUCCESS) {
111 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
112 FAIL = 1;
113 }
114
115 test_validate(FAIL, 0);
116}
117
119{
120 int FAIL = 0;
122 // Creating a MxN VDEST with id = 2000
124 if (rc != NCSCC_RC_SUCCESS) {
125 printf("\nFail to Creating a MxN VDEST with id = 2000\n");
126 FAIL = 1;
127 }
128
129 printf(
130 "\nTest case 2: Installing the Internal MIN service INTMIN with NODE scope without MDS Queue ownership and failing to Retrieve");
131 // Installing the Internal MIN service INTMIN with NODE scope without
132 // MDS Q ownership and failing to Retrieve
133 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
135 NCSMDS_SCOPE_INTRANODE, false, false);
136 if (rc != NCSCC_RC_SUCCESS) {
137 printf(
138 "\nFail to Install the Internal MIN service INTMIN with NODE scope without MDS Q ownership\n");
139 FAIL = 1;
140 }
141
142 // Retrieve shall fail
143 if (mds_service_retrieve(gl_tet_vdest[0].mds_pwe1_hdl,
146 printf("\nFail, Possible to retrieve\n");
147 FAIL = 1;
148 }
149
150 // Uninstalling the above service
151 rc = mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
153 if (rc != NCSCC_RC_SUCCESS) {
154 printf("\nFail to uninstall the above service\n");
155 FAIL = 1;
156 }
157
158 // Destroying a MxN VDEST with id = 2000
159 rc = destroy_vdest(2000);
160 if (rc != NCSCC_RC_SUCCESS) {
161 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
162 FAIL = 1;
163 }
164
165 test_validate(FAIL, 0);
166}
167
169{
170 int FAIL = 0;
172 // Creating a MxN VDEST with id = 2000
174 if (rc != NCSCC_RC_SUCCESS) {
175 printf("\nFail to Creating a MxN VDEST with id = 2000\n");
176 FAIL = 1;
177 }
178 printf(
179 "\nTest case 3: Installing the External MIN service EXTMIN with CHASSIS scope");
180 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
182 NCSMDS_SCOPE_INTRACHASSIS, true, false);
183 if (rc != NCSCC_RC_SUCCESS) {
184 printf(
185 "\nFail to Installing the External MIN service EXTMIN with CHASSIS scope\n");
186 FAIL = 1;
187 }
188
189 // Uninstalling the above service\n");
190 rc = mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
192
193 if (rc != NCSCC_RC_SUCCESS) {
194 printf("\nFail to Uninstalling the above service\n");
195 FAIL = 1;
196 }
197
198 // Destroying a MxN VDEST with id = 2000
199 rc = destroy_vdest(2000);
200 if (rc != NCSCC_RC_SUCCESS) {
201 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
202 FAIL = 1;
203 }
204
205 test_validate(FAIL, 0);
206}
207
209{
210 int FAIL = 0;
212 // Creating a MxN VDEST with id = 2000
214 if (rc != NCSCC_RC_SUCCESS) {
215 printf("\nFail to Creating a MxN VDEST with id = 2000\n");
216 FAIL = 1;
217 }
218
219 printf(
220 "\nTest case 5: Installing the service with MAX id:32767 with CHASSIS scope");
222 1, NCSMDS_SCOPE_INTRACHASSIS, true, false);
223 if (rc != NCSCC_RC_SUCCESS) {
224 printf(
225 "\nFail to Installing the service with MAX id:32767 with CHASSIS scope\n");
226 FAIL = 1;
227 }
228
229 // Uninstalling the above service
230 rc = mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
232 if (rc != NCSCC_RC_SUCCESS) {
233 printf("\nFail to Uninstalling the above service\n");
234 FAIL = 1;
235 }
236
237 // Destroying a MxN VDEST with id = 2000
238 rc = destroy_vdest(2000);
239 if (rc != NCSCC_RC_SUCCESS) {
240 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
241 FAIL = 1;
242 }
243
244 test_validate(FAIL, 0);
245}
246
248{
249 int FAIL = 0;
251 // Creating a MxN VDEST with id = 2000
253 if (rc != NCSCC_RC_SUCCESS) {
254 printf("\nFail to Creating a MxN VDEST with id = 2000\n");
255 FAIL = 1;
256 }
257
258 printf(
259 "\nTest case 6:Not able to Install the service with id > MAX:32767 with CHASSIS scope\n");
260 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
261 NCSMDS_MAX_SVCS + 1, 1,
262 NCSMDS_SCOPE_INTRACHASSIS, true, false);
263 if (rc != NCSCC_RC_FAILURE) {
264 printf(
265 "\nPossible to Install the service with id > MAX:32767 with CHASSIS scope\n");
266 FAIL = 1;
267 }
268
269 // Destroying a MxN VDEST with id = 2000
270 rc = destroy_vdest(2000);
271 if (rc != NCSCC_RC_SUCCESS) {
272 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
273 FAIL = 1;
274 }
275
276 test_validate(FAIL, 0);
277}
278
280{
281 int FAIL = 0;
283 // Creating a MxN VDEST with id = 2000
285 if (rc != NCSCC_RC_SUCCESS) {
286 printf("\nFail to Creating a MxN VDEST with id = 2000\n");
287 FAIL = 1;
288 }
289
290 printf("\nTest case 7: Not able to Install the service with id =0");
291 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, 0, 1,
292 NCSMDS_SCOPE_NONE, false, false);
293 if (rc != NCSCC_RC_FAILURE) {
294 printf("\nPossible to Install the service with id =0\n");
295 FAIL = 1;
296 }
297
298 // Destroying a MxN VDEST with id = 2000
299 rc = destroy_vdest(2000);
300 if (rc != NCSCC_RC_SUCCESS) {
301 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
302 FAIL = 1;
303 }
304
305 test_validate(FAIL, 0);
306}
307
309{
310 int FAIL = 0;
312 // Creating a MxN VDEST with id = 2000
314 if (rc != NCSCC_RC_SUCCESS) {
315 printf("\nFail to Creating a MxN VDEST with id = 2000\n");
316 FAIL = 1;
317 }
318
319 printf(
320 "\nTest case 8:Not able to Install the service with Invalid PWE Handle");
321 rc = mds_service_install((MDS_HDL)(long)NULL, 100, 1, NCSMDS_SCOPE_NONE,
322 false, false);
323
324 if (rc != NCSCC_RC_FAILURE) {
325 printf(
326 "\nPossible to Install the service with Invalid (NULL) PWE Handle\n");
327 FAIL = 1;
328 }
329
330 rc = mds_service_install(0, 100, 1, NCSMDS_SCOPE_NONE, false, false);
331 if (rc != NCSCC_RC_FAILURE) {
332 printf(
333 "\nPossible to Install the service with Invalid (Zero) PWE Handle\n");
334 FAIL = 1;
335 }
336
337 rc = mds_service_install(gl_tet_vdest[0].mds_vdest_hdl, 100, 1,
338 NCSMDS_SCOPE_NONE, false, false);
339 if (rc != NCSCC_RC_FAILURE) {
340 printf(
341 "\nPossible to Install the service with Invalid PWE Handle\n");
342 FAIL = 1;
343 }
344
345 // Destroying a MxN VDEST with id = 2000
346 rc = destroy_vdest(2000);
347 if (rc != NCSCC_RC_SUCCESS) {
348 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
349 FAIL = 1;
350 }
351
352 test_validate(FAIL, 0);
353}
354
356{
357 int FAIL = 0;
359 // Creating a MxN VDEST with id = 2000
361 if (rc != NCSCC_RC_SUCCESS) {
362 printf("\nFail to Creating a MxN VDEST with id = 2000\n");
363 FAIL = 1;
364 }
365
366 printf(
367 "\nTest case 9:Not able to Install a Service with Svc id > External MIN 2000 which doesn't chose MDS Q Ownership");
368 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
370 NCSMDS_SCOPE_INTRANODE, false, false);
371 if (rc != NCSCC_RC_FAILURE) {
372 printf(
373 "\nAble to Install a Service with Svc id > External MIN 2000 which doesn't chose MDS Q Ownership\n");
374 FAIL = 1;
375 }
376
377 // Destroying a MxN VDEST with id = 2000
378 rc = destroy_vdest(2000);
379 if (rc != NCSCC_RC_SUCCESS) {
380 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
381 FAIL = 1;
382 }
383
384 test_validate(FAIL, 0);
385}
386
388{
389 int FAIL = 0;
391 NCSCONTEXT t_handle = 0;
392 // Creating a MxN VDEST with id = 2000
394 if (rc != NCSCC_RC_SUCCESS) {
395 printf("\nFail to Creating a MxN VDEST with id = 2000\n");
396 FAIL = 1;
397 }
398
399 printf(
400 "\nTest case 10:Installing the External MIN service EXTMIN in a seperate thread and Uninstalling it here\n");
401 // Install thread
403 if (rc != NCSCC_RC_SUCCESS) {
404 printf("\nFail to Install thread\n");
405 FAIL = 1;
406 }
407 // Now Release the Install Thread
408 rc = tet_release_task(t_handle);
409 if (rc != NCSCC_RC_SUCCESS) {
410 printf("\nFail to release thread\n");
411 FAIL = 1;
412 }
413
414 // Counter shall be != 0
415 pthread_mutex_lock(&gl_mutex);
416 if (gl_tet_vdest[0].svc_count == 0) {
417 printf("\nsvc_count == 0\n");
418 FAIL = 1;
419 };
420 pthread_mutex_unlock(&gl_mutex);
421
422 // Uninstalling the above service
423 rc = mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
425 if (rc != NCSCC_RC_SUCCESS) {
426 printf("\nFail to Uninstalling the above service\n");
427 FAIL = 1;
428 }
429 // Destroying a MxN VDEST with id = 2000
430 rc = destroy_vdest(2000);
431 if (rc != NCSCC_RC_SUCCESS) {
432 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
433 FAIL = 1;
434 }
435
436 test_validate(FAIL, 0);
437}
438
440{
441 int FAIL = 0;
443 // Creating a MxN VDEST with id = 2000
445 if (rc != NCSCC_RC_SUCCESS) {
446 printf("\nFail to Creating a MxN VDEST with id = 2000\n");
447 FAIL = 1;
448 }
449
450 printf(
451 "\nTest case:Installation of the same Service id with different sub-part versions on the same pwe handle, must fail\n");
452 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
454 NCSMDS_SCOPE_INTRANODE, true, false);
455 if (rc != NCSCC_RC_SUCCESS) {
456 printf("\nFail to Installing the service\n");
457 FAIL = 1;
458 }
459
460 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
462 NCSMDS_SCOPE_INTRANODE, true, false);
463 if (rc != NCSCC_RC_FAILURE) {
464 printf(
465 "\nPossible to install the same Service id with different sub-part versions on the same pwe handle\n");
466 FAIL = 1;
467 }
468
469 // Uninstalling the above service
470 rc = mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
472 if (rc != NCSCC_RC_SUCCESS) {
473 printf("\nFail to uninstalling the above service\n");
474 FAIL = 1;
475 }
476
477 // Destroying a MxN VDEST with id = 2000
478 rc = destroy_vdest(2000);
479 if (rc != NCSCC_RC_SUCCESS) {
480 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
481 FAIL = 1;
482 }
483
484 test_validate(FAIL, 0);
485}
486
488{
489 int FAIL = 0;
491 // Creating a MxN VDEST with id = 2000
493 if (rc != NCSCC_RC_SUCCESS) {
494 printf("\nFail to Creating a MxN VDEST with id = 2000\n");
495 FAIL = 1;
496 }
497
498 printf(
499 "\nTest case 12: Installation of the same Service id with same sub-part versions on the same pwe handle, must fail\n");
500 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
502 NCSMDS_SCOPE_INTRANODE, true, false);
503 if (rc != NCSCC_RC_SUCCESS) {
504 printf("\nFail to create service\n");
505 FAIL = 1;
506 }
507
508 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
510 NCSMDS_SCOPE_INTRANODE, true, false);
511 if (rc != NCSCC_RC_FAILURE) {
512 printf(
513 "\nPossible to install the same Service id with same sub-part versions on the same pwe handle\n");
514 FAIL = 1;
515 }
516
517 // Uninstalling the above service
518 rc = mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
520 if (rc != NCSCC_RC_SUCCESS) {
521 printf("\nFail to uninstall the above service\n");
522 FAIL = 1;
523 }
524
525 // Destroying a MxN VDEST with id = 2000
526 rc = destroy_vdest(2000);
527 if (rc != NCSCC_RC_SUCCESS) {
528 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
529 FAIL = 1;
530 }
531
532 test_validate(FAIL, 0);
533}
534
536{
537 int FAIL = 0;
539 // Creating a MxN VDEST with id = 2000
541 if (rc != NCSCC_RC_SUCCESS) {
542 printf("\nFail to Creating a MxN VDEST with id = 2000\n");
543 FAIL = 1;
544 }
545
546 printf(
547 "\nTest case 13: Install a service with _mds_svc_pvt_ver = 0 i_mds_svc_pvt_ver = 255 and i_mds_svc_pvt_ver = A random value, which is >0 and <255\n");
549 if (rc != NCSCC_RC_SUCCESS) {
550 printf("\nFail to get handle\n");
551 FAIL = 1;
552 }
553
556 NCSMDS_SCOPE_NONE, true, true);
557 if (rc != NCSCC_RC_SUCCESS) {
558 printf("\nFail to install service NCSMDS_SCOPE_NONE\n");
559 FAIL = 1;
560 }
561
564 if (rc != NCSCC_RC_SUCCESS) {
565 printf("\nFail to uninstall service NCSMDS_SCOPE_NONE\n");
566 FAIL = 1;
567 }
568
571 NCSMDS_SCOPE_INTRACHASSIS, true, true);
572 if (rc != NCSCC_RC_SUCCESS) {
573 printf("\nFail to install service NCSMDS_SCOPE_INTRACHASSIS\n");
574 FAIL = 1;
575 }
576
579 if (rc != NCSCC_RC_SUCCESS) {
580 printf(
581 "\nFail to uninstall service NCSMDS_SCOPE_INTRACHASSIS\n");
582 FAIL = 1;
583 }
584
587 NCSMDS_SCOPE_INTRANODE, true, true);
588 if (rc != NCSCC_RC_SUCCESS) {
589 printf("\nFail to install service NCSMDS_SCOPE_INTRANODE\n");
590 FAIL = 1;
591 }
592
595 if (rc != NCSCC_RC_SUCCESS) {
596 printf("\nFail to uninstall service NCSMDS_SCOPE_INTRANODE\n");
597 FAIL = 1;
598 }
599 // Destroying a MxN VDEST with id = 2000
600 rc = destroy_vdest(2000);
601 if (rc != NCSCC_RC_SUCCESS) {
602 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
603 FAIL = 1;
604 }
605
606 test_validate(FAIL, 0);
607}
608
610{
611 int FAIL = 0;
613 // Creating a MxN VDEST with id = 2000
615 if (rc != NCSCC_RC_SUCCESS) {
616 printf("\nFail to Creating a MxN VDEST with id = 2000\n");
617 FAIL = 1;
618 }
619
620 printf(
621 "\nTest case 14: Install a service with i_fail_no_active_sends = 0 and i_fail_no_active_sends = 1\n");
623 if (rc != NCSCC_RC_SUCCESS) {
624 printf("\nFail to get handle\n");
625 FAIL = 1;
626 }
627
630 NCSMDS_SCOPE_NONE, true,
631 false); // i_fail_no_active_sends = 0
632 if (rc != NCSCC_RC_SUCCESS) {
633 printf("\nFail to install service NCSMDS_SCOPE_NONE\n");
634 FAIL = 1;
635 }
636
639 if (rc != NCSCC_RC_SUCCESS) {
640 printf("\nFail to uninstall service NCSMDS_SCOPE_NONE\n");
641 FAIL = 1;
642 }
643
647 true); // i_fail_no_active_sends = 1
648 if (rc != NCSCC_RC_SUCCESS) {
649 printf("\nFail to install service NCSMDS_SCOPE_INTRACHASSIS\n");
650 FAIL = 1;
651 }
652
653 // Uninstalling the above service
656 if (rc != NCSCC_RC_SUCCESS) {
657 printf(
658 "\nFail to uninstall service NCSMDS_SCOPE_INTRACHASSIS\n");
659 FAIL = 1;
660 }
661
662 // Destroying a MxN VDEST with id = 2000
663 rc = destroy_vdest(2000);
664 if (rc != NCSCC_RC_SUCCESS) {
665 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
666 FAIL = 1;
667 }
668
669 test_validate(FAIL, 0);
670}
671
673{
674 int FAIL = 0;
676 // Creating a MxN VDEST with id = 2000
678 if (rc != NCSCC_RC_SUCCESS) {
679 printf("\nFail to Creating a MxN VDEST with id = 2000\n");
680 FAIL = 1;
681 }
682
683 printf(
684 "\nTest case 15: Installation of a service with same service id and i_fail_no_active_sends twice on the same pwe handle, must fail\n");
685 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
688 true); // i_fail_no_active_sends
689 if (rc != NCSCC_RC_SUCCESS) {
690 printf("\nFail to install service NCSMDS_SCOPE_INTRANODE\n");
691 FAIL = 1;
692 }
693
694 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
697 true); // i_fail_no_active_sends
698 if (rc != NCSCC_RC_FAILURE) {
699 printf(
700 "\nPossible to install service NCSMDS_SCOPE_INTRANODE twice\n");
701 FAIL = 1;
702 }
703
704 // Uninstalling the above service
705 rc = mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
707 if (rc != NCSCC_RC_SUCCESS) {
708 printf("\nFail to uninstall service NCSMDS_SCOPE_INTRANODE\n");
709 FAIL = 1;
710 }
711
712 // Destroying a MxN VDEST with id = 2000
713 rc = destroy_vdest(2000);
714 if (rc != NCSCC_RC_SUCCESS) {
715 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
716 FAIL = 1;
717 }
718
719 test_validate(FAIL, 0);
720}
721
723{
724 int FAIL = 0;
726 // Creating a MxN VDEST with id = 2000
728 if (rc != NCSCC_RC_SUCCESS) {
729 printf("\nFail to Creating a MxN VDEST with id = 2000\n");
730 FAIL = 1;
731 }
732
733 printf(
734 "\nTest case 16: Installation of a service with same service id and different i_fail_no_active_sends again on the same pwe handle, must fail\n");
735 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
738 true); // i_fail_no_active_send = 1
739 if (rc != NCSCC_RC_SUCCESS) {
740 printf(
741 "\nFail to install the service NCSMDS_SCOPE_INTRANODE\n");
742 FAIL = 1;
743 }
744
745 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
748 false); // i_fail_no_active_send = 0
749 if (rc != NCSCC_RC_FAILURE) {
750 printf(
751 "\nPossible to install a service with same service id and different i_fail_no_active_sends again on the same pwe handle\n");
752 FAIL = 1;
753 }
754
755 // Uninstalling the above service\n");
756 rc = mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
758 if (rc != NCSCC_RC_SUCCESS) {
759 printf(
760 "\nFail to uninstall the service NCSMDS_SCOPE_INTRANODE\n");
761 FAIL = 1;
762 }
763
764 // Destroying a MxN VDEST with id = 2000
765 rc = destroy_vdest(2000);
766 if (rc != NCSCC_RC_SUCCESS) {
767 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
768 FAIL = 1;
769 }
770
771 test_validate(FAIL, 0);
772}
773
775{
776 int FAIL = 0;
778 // Creating a MxN VDEST with id = 2000
780 if (rc != NCSCC_RC_SUCCESS) {
781 printf("\nFail to Creating a MxN VDEST with id = 2000\n");
782 FAIL = 1;
783 }
784
785 printf(
786 "\nTest case 17: For MDS_INSTALL API, supply i_yr_svc_hdl = (2^32) and i_yr_svc_hdl = (2^64 -1)\n");
787 gl_tet_svc.yr_svc_hdl = 4294967296ULL;
788 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
790 NCSMDS_SCOPE_INTRANODE, true, true);
791 if (rc != NCSCC_RC_SUCCESS) {
792 printf(
793 "\nFail to install service NCSMDS_SVC_ID_EXTERNAL_MIN\n");
794 FAIL = 1;
795 }
796
797 gl_tet_svc.yr_svc_hdl = 18446744073709551615ULL;
798 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
800 NCSMDS_SCOPE_INTRANODE, true, true);
801 if (rc != NCSCC_RC_SUCCESS) {
802 printf(
803 "\nFail to install service NCSMDS_SVC_ID_INTERNAL_MIN\n");
804 FAIL = 1;
805 }
806
807 // Uninstalling the above services
808 rc = mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
810 if (rc != NCSCC_RC_SUCCESS) {
811 printf(
812 "\nFail to uninstall service NCSMDS_SVC_ID_EXTERNAL_MIN\n");
813 FAIL = 1;
814 }
815
816 rc = mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
818 if (rc != NCSCC_RC_SUCCESS) {
819 printf(
820 "\nFail to uninstall service NCSMDS_SVC_ID_INTERNAL_MIN\n");
821 FAIL = 1;
822 }
823
824 // Destroying a MxN VDEST with id = 2000
825 rc = destroy_vdest(2000);
826 if (rc != NCSCC_RC_SUCCESS) {
827 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
828 FAIL = 1;
829 }
830
831 test_validate(FAIL, 0);
832}
833
835{
836 // Inside Thread
837 printf("tet_vdest_uninstall_thread\n");
838 mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl, 500);
839}
840
842{
843 int FAIL = 0;
845 printf(
846 "\nTest Case 1: Not able to Uninstall an ALREADY uninstalled service\n");
847 // Creating a N-way VDEST with id =1001
849 if (rc != NCSCC_RC_SUCCESS) {
850 printf("\nFail to creating a N-way VDEST with id =1001\n");
851 FAIL = 1;
852 }
853
854 // Installing the service 500
855 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, 500, 1,
856 NCSMDS_SCOPE_INTRANODE, true, false);
857 if (rc != NCSCC_RC_SUCCESS) {
858 printf("\nFail to install the service 500\n");
859 FAIL = 1;
860 }
861
862 // Uninstalling the above service
863 rc = mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl, 500);
864 if (rc != NCSCC_RC_SUCCESS) {
865 printf("\nFail to uninstall the service 500\n");
866 FAIL = 1;
867 }
868
869 // Not able to Uninstall an ALREADY uninstalled service
870 rc = mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl, 500);
871 if (rc != NCSCC_RC_FAILURE) {
872 printf(
873 "\nPossible to uninstall already uninstalled service 500\n");
874 FAIL = 1;
875 }
876 rc = destroy_vdest(1001);
877 if (rc != NCSCC_RC_SUCCESS) {
878 printf("\nFail to Destroying a MxN VDEST with id = 2000\n");
879 FAIL = 1;
880 }
881
882 test_validate(FAIL, 0);
883}
884
886{
887 int FAIL = 0;
889 printf(
890 "\nTest Case 3: Not able to Uninstall a Service which doesn't exist\n");
891 // Creating a N-way VDEST with id =1001
893 if (rc != NCSCC_RC_SUCCESS) {
894 printf("\nCreating a N-way VDEST with id =1001\n");
895 FAIL = 1;
896 }
897
898 rc = mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl, 600);
899 if (rc != NCSCC_RC_FAILURE) {
900 printf(
901 "\nPossible to uninstall a service which doesn't exist\n");
902 FAIL = 1;
903 }
904
905 // Destroying a MxN VDEST with id = 1001
906 rc = destroy_vdest(1001);
907 if (rc != NCSCC_RC_SUCCESS) {
908 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
909 FAIL = 1;
910 }
911
912 test_validate(FAIL, 0);
913}
914
916{
917 int FAIL = 0;
919 printf("\nTest Case 4: UnInstalling wit invalid handles\n");
920 // Creating a N-way VDEST with id =1001
922 if (rc != NCSCC_RC_SUCCESS) {
923 printf("\nCreating a N-way VDEST with id =1001\n");
924 FAIL = 1;
925 }
926
927 // Installing a service EXTMIN
928 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
930 NCSMDS_SCOPE_INTRACHASSIS, true, false);
931 if (rc != NCSCC_RC_SUCCESS) {
932 printf("\nFail to install a service EXTMIN\n");
933 FAIL = 1;
934 }
935
936 // Not able to Uninstall the above Service with NULL PWE handle
937 rc = mds_service_uninstall((MDS_HDL)(long)NULL,
939 if (rc != NCSCC_RC_FAILURE) {
940 printf(
941 "\nPossible to uninstall the Service with NULL PWE handle\n");
942 FAIL = 1;
943 }
944
945 // Not able to Uninstall the above Service with ZERO PWE handle
947 if (rc != NCSCC_RC_FAILURE) {
948 printf(
949 "\nPossible to uninstall the Service with ZERO PWE handle\n");
950 FAIL = 1;
951 }
952
953 // Not able to Uninstall the above Service with VDEST handle\n");
954 rc = mds_service_uninstall(gl_tet_vdest[0].mds_vdest_hdl,
956 if (rc != NCSCC_RC_FAILURE) {
957 printf(
958 "\nPossible to uninstall the Service with VDEST handle\n");
959 FAIL = 1;
960 }
961
962 // Uninstalling the above service
963 rc = mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
965 if (rc != NCSCC_RC_SUCCESS) {
966 printf("\nFail to Uninstall the MDS service\n");
967 FAIL = 1;
968 }
969
970 // Destroying a MxN VDEST with id = 1001
971 rc = destroy_vdest(1001);
972 if (rc != NCSCC_RC_SUCCESS) {
973 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
974 FAIL = 1;
975 }
976
977 test_validate(FAIL, 0);
978}
979
981{
982 int FAIL = 0;
984 printf("\nTest Case 5: Uninstalling a service in a seperate thread\n");
985 // Creating a N-way VDEST with id =1001
987 if (rc != NCSCC_RC_SUCCESS) {
988 printf("\nCreating a N-way VDEST with id =1001\n");
989 FAIL = 1;
990 }
991
992 // Installing the service 500
993 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, 500, 1,
994 NCSMDS_SCOPE_INTRANODE, true, false);
995 if (rc != NCSCC_RC_SUCCESS) {
996 printf("\nFail to install service 500\n");
997 FAIL = 1;
998 }
999
1000 // Uninstalling the above service in a seperate thread
1001 // Uninstall thread
1003 &gl_tet_vdest[0].svc[0].task.t_handle);
1004 if (rc != NCSCC_RC_SUCCESS) {
1005 printf("\nFail to create the uninstall thread\n");
1006 FAIL = 1;
1007 }
1008
1009 // Now Release the Uninstall Thread
1010 rc = tet_release_task(gl_tet_vdest[0].svc[0].task.t_handle);
1011 if (rc != NCSCC_RC_SUCCESS) {
1012 printf("\nFail to release the uninstall thread\n");
1013 FAIL = 1;
1014 }
1015
1016 // Test gl_tet_vdest[0].svc_count == 0
1017 pthread_mutex_lock(&gl_mutex);
1018 if (gl_tet_vdest[0].svc_count != 0) {
1019 printf("\nsvc_count is %d, should be 0\n",
1020 gl_tet_vdest[0].svc_count);
1021 FAIL = 1;
1022 }
1023 pthread_mutex_unlock(&gl_mutex);
1024
1025 // Destroying a MxN VDEST with id = 1001
1026 rc = destroy_vdest(1001);
1027 if (rc != NCSCC_RC_SUCCESS) {
1028 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
1029 FAIL = 1;
1030 }
1031
1032 test_validate(FAIL, 0);
1033}
1034
1036{
1037 int id = 0;
1038 gl_vdest_indx = 0;
1039 int FAIL = 0;
1040 SaUint32T rc;
1041 printf("\nTest Case 6: svc_install_upto_MAX\n");
1042 // Creating a N-way VDEST with id =1001
1044 if (rc != NCSCC_RC_SUCCESS) {
1045 printf("\nCreating a N-way VDEST with id =1001\n");
1046 FAIL = 1;
1047 }
1048
1049 printf("\nNo. of Services = %d\n", gl_tet_vdest[0].svc_count);
1050 fflush(stdout);
1051 sleep(1);
1052 /*With MDS Q ownership*/
1053 printf("\tInstalling the services from SVC_ID_INTERNAL_MIN to +500\n");
1054 for (id = NCSMDS_SVC_ID_INTERNAL_MIN + 1;
1055 id <= NCSMDS_SVC_ID_INTERNAL_MIN + 500; id++) {
1056 rc = mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, id, 1,
1057 NCSMDS_SCOPE_NONE, true, false);
1058 if (rc != NCSCC_RC_SUCCESS)
1059 break;
1060 }
1061
1062 printf("\tMAX number of service that can be created on a VDEST = %d",
1063 gl_tet_vdest[0].svc_count);
1064 printf("\nNo. of Services= %d\n", gl_tet_vdest[0].svc_count);
1065 fflush(stdout);
1066 sleep(4);
1067 printf("\tUninstalling the above service\n");
1068 for (id = gl_tet_vdest[0].svc_count - 1; id >= 0; id--) {
1069 rc = mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
1070 gl_tet_vdest[0].svc[id].svc_id);
1071 if (rc != NCSCC_RC_SUCCESS) {
1072 printf("\nFail to uninstall a service id %d\n", id);
1073 FAIL = 1;
1074 }
1075 }
1076
1077 printf("\nNo. of Services = %d\n", gl_tet_vdest[0].svc_count);
1078 fflush(stdout);
1079 sleep(1);
1080
1081 // Destroying a MxN VDEST with id = 1001
1082 rc = destroy_vdest(1001);
1083 if (rc != NCSCC_RC_SUCCESS) {
1084 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
1085 FAIL = 1;
1086 }
1087
1088 test_validate(FAIL, 0);
1089}
1090
1092 NCSMDS_SVC_ID req_svc_id,
1093 MDS_SVC_PVT_SUB_PART_VER svc_pvt_ver,
1094 NCSMDS_CHG change)
1095{
1096 int i, j, k, ret_val = 0;
1097 if (is_service_on_adest(mds_hdl, your_scv_id) == NCSCC_RC_SUCCESS) {
1098 for (i = 0; i < gl_tet_adest.svc_count; i++) {
1099 if (gl_tet_adest.svc[i].svc_id == your_scv_id) {
1100 for (j = 0;
1102 j++) {
1103 if (gl_tet_adest.svc[i]
1104 .svcevt[j]
1105 .svc_id == req_svc_id) {
1106 if ((gl_tet_adest.svc[i]
1107 .svcevt[j]
1108 .event == change) &&
1109 (gl_tet_adest.svc[i]
1110 .svcevt[j]
1111 .rem_svc_pvt_ver ==
1112 svc_pvt_ver))
1113 ret_val = 1;
1114 else
1115 ret_val = 0;
1116 }
1117 }
1118 }
1119 }
1120 } else {
1121 for (i = 0; i < gl_vdest_indx; i++) {
1122 for (j = 0; j < gl_tet_vdest[i].svc_count; j++) {
1123 if (gl_tet_vdest[i].svc[j].svc_id ==
1124 your_scv_id) {
1125 for (k = 0; k < gl_tet_vdest[i]
1126 .svc[j]
1127 .subscr_count;
1128 k++) {
1129 if (gl_tet_vdest[i]
1130 .svc[j]
1131 .svcevt[k]
1132 .svc_id == req_svc_id) {
1133 if ((gl_tet_vdest[i]
1134 .svc[j]
1135 .svcevt[k]
1136 .event ==
1137 change) &&
1138 (gl_tet_vdest[i]
1139 .svc[j]
1140 .svcevt[k]
1141 .rem_svc_pvt_ver ==
1142 svc_pvt_ver))
1143 ret_val = 1;
1144 else
1145 ret_val = 0;
1146 }
1147 }
1148 }
1149 }
1150 }
1151 }
1152 return ret_val;
1153}
1155{
1156 int FAIL = 0;
1157 SaUint32T rc;
1158 int id;
1159 MDS_SVC_ID svcids[] = {600, 700};
1160 printf(
1161 "\nTest Case 1: 500 Subscription to:600,700 where Install scope = Subscription scope\n");
1162
1163 // Creating a N-way VDEST with id =1001
1165 if (rc != NCSCC_RC_SUCCESS) {
1166 printf("\nCreating a N-way VDEST with id =1001\n");
1167 FAIL = 1;
1168 }
1169
1170 printf("\nInstalling the service 500,600,700 with CHASSIS scope\n");
1171 for (id = 500; id <= 700; id = id + 100) {
1172 rc =
1173 mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, id, 1,
1174 NCSMDS_SCOPE_INTRACHASSIS, true, false);
1175 if (rc != NCSCC_RC_SUCCESS) {
1176 printf("\nFail to install service %d\n", id);
1177 FAIL = 1;
1178 }
1179 }
1180
1181 printf(
1182 "\n500 Subscription to:600,700 where Install scope = Subscription scope");
1183 rc = mds_service_subscribe(gl_tet_vdest[0].mds_pwe1_hdl, 500,
1184 NCSMDS_SCOPE_INTRACHASSIS, 2, svcids);
1185 if (rc != NCSCC_RC_SUCCESS) {
1186 printf("\nFail to subscribe service 500\n");
1187 FAIL = 1;
1188 }
1189
1190 rc = mds_service_cancel_subscription(gl_tet_vdest[0].mds_pwe1_hdl, 500,
1191 2, svcids);
1192 if (rc != NCSCC_RC_SUCCESS) {
1193 printf("\nFail to cancel subscription service 500\n");
1194 FAIL = 1;
1195 }
1196
1197 // clean up
1198 // Uninstalling all the services on this VDEST
1199 for (id = gl_tet_vdest[0].svc_count - 1; id >= 0; id--)
1200 if (mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
1201 gl_tet_vdest[0].svc[id].svc_id) !=
1203 printf("\nFail mds_service_uninstall\n");
1204 FAIL = 1;
1205 }
1206
1207 // Destroying a MxN VDEST with id = 1001
1208 rc = destroy_vdest(1001);
1209 if (rc != NCSCC_RC_SUCCESS) {
1210 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
1211 FAIL = 1;
1212 }
1213
1214 test_validate(FAIL, 0);
1215}
1216
1218{
1219 bool FAIL = 0;
1220 SaUint32T rc;
1221 int id;
1222 MDS_SVC_ID svcids[] = {600, 700};
1223 printf(
1224 "\nTest Case 2: 500 Subscription to:600,700 where Install scope >Subscription scope (NODE)\n");
1225 // Creating a N-way VDEST with id =1001
1227 if (rc != NCSCC_RC_SUCCESS) {
1228 printf("\nCreating a N-way VDEST with id =1001\n");
1229 FAIL = 1;
1230 }
1231
1232 printf("\nInstalling the service 500,600,700 with CHASSIS scope\n");
1233 for (id = 500; id <= 700; id = id + 100) {
1234 rc =
1235 mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, id, 1,
1236 NCSMDS_SCOPE_INTRACHASSIS, true, false);
1237 if (rc != NCSCC_RC_SUCCESS) {
1238 printf("\nFail to install service %d\n", id);
1239 FAIL = 1;
1240 }
1241 }
1242
1243 /*install scope > subscribe scope*/
1244 printf(
1245 "\n500 Subscription to:600,700 where Install scope > Subscription scope (NODE)\n");
1246 rc = mds_service_subscribe(gl_tet_vdest[0].mds_pwe1_hdl, 500,
1247 NCSMDS_SCOPE_INTRANODE, 2, svcids);
1248 if (rc != NCSCC_RC_SUCCESS) {
1249 printf("\nFail to subscribe service 500\n");
1250 FAIL = 1;
1251 }
1252
1253 rc = mds_service_cancel_subscription(gl_tet_vdest[0].mds_pwe1_hdl, 500,
1254 2, svcids);
1255 if (rc != NCSCC_RC_SUCCESS) {
1256 printf("\nFail to cancel subscription service 500\n");
1257 FAIL = 1;
1258 }
1259
1260 // clean up
1261 // Uninstalling all the services on this VDEST
1262 for (id = gl_tet_vdest[0].svc_count - 1; id >= 0; id--)
1263 if (mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
1264 gl_tet_vdest[0].svc[id].svc_id) !=
1266 printf("\nFail mds_service_uninstall\n");
1267 FAIL = 1;
1268 }
1269
1270 // Destroying a MxN VDEST with id = 1001
1271 rc = destroy_vdest(1001);
1272 if (rc != NCSCC_RC_SUCCESS) {
1273 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
1274 FAIL = 1;
1275 }
1276
1277 test_validate(FAIL, 0);
1278}
1279
1281{
1282 int FAIL = 0;
1283 SaUint32T rc;
1284 int id;
1285 MDS_SVC_ID svcids[] = {600, 700};
1286 printf(
1287 "\nTest Case 3: Not able to: 500 Subscription to:600,700 where Install scope < Subscription scope(PWE\n");
1288 // Creating a N-way VDEST with id =1001
1290 if (rc != NCSCC_RC_SUCCESS) {
1291 printf("\nFail creating a N-way VDEST with id =1001\n");
1292 FAIL = 1;
1293 }
1294
1295 printf("\nInstalling the service 500,600,700 with CHASSIS scope");
1296 for (id = 500; id <= 700; id = id + 100) {
1297 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, id, 1,
1299 false) != NCSCC_RC_SUCCESS) {
1300 printf("Fail");
1301 FAIL = 1;
1302 }
1303 }
1304
1305 // install scope < subscribe scope
1306 // Not able to: 500 Subscription to:600,700 where Install scope <
1307 // Subscription scope(PWE)
1308 rc = mds_service_subscribe(gl_tet_vdest[0].mds_pwe1_hdl, 500,
1309 NCSMDS_SCOPE_NONE, 2, svcids);
1310 if (rc == NCSCC_RC_SUCCESS) {
1311 printf(
1312 "\nFail: Able to 500 Subscription to:600,700 where Install scope < Subscription scope(PWE)\n");
1313 FAIL = 1;
1314 }
1315
1316 // clean up
1317 // Uninstalling all the services on this VDEST
1318 for (id = gl_tet_vdest[0].svc_count - 1; id >= 0; id--)
1319 if (mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
1320 gl_tet_vdest[0].svc[id].svc_id) !=
1322 printf("\nFail mds_service_uninstall\n");
1323 FAIL = 1;
1324 }
1325
1326 // Destroying a MxN VDEST with id = 1001
1327 rc = destroy_vdest(1001);
1328 if (rc != NCSCC_RC_SUCCESS) {
1329 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
1330 FAIL = 1;
1331 }
1332
1333 test_validate(FAIL, 0);
1334}
1335
1337{
1338 int FAIL = 0;
1339 SaUint32T rc;
1340 int id;
1341 MDS_SVC_ID svcids[] = {600, 700};
1342 printf(
1343 "\nTest Case 4: Not able to: 500 Subscription to:600,700 where Install scope < Subscription scope(PWE)\n");
1344 // Creating a N-way VDEST with id =1001
1346 if (rc != NCSCC_RC_SUCCESS) {
1347 printf("\nCreating a N-way VDEST with id =1001\n");
1348 FAIL = 1;
1349 }
1350
1351 printf("\nInstalling the service 500,600,700 with CHASSIS scope");
1352 for (id = 500; id <= 700; id = id + 100) {
1353 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, id, 1,
1355 false) != NCSCC_RC_SUCCESS) {
1356 printf("Fail");
1357 FAIL = 1;
1358 }
1359 }
1360
1361 // Not able to subscribe again:500 Subscribing to service 600, 700");
1362 rc = mds_service_subscribe(gl_tet_vdest[0].mds_pwe1_hdl, 500,
1363 NCSMDS_SCOPE_INTRACHASSIS, 2, svcids);
1364 if (rc != NCSCC_RC_SUCCESS) {
1365 printf("\nFail to subscribe service 500\n");
1366 FAIL = 1;
1367 }
1368
1369 rc = mds_service_subscribe(gl_tet_vdest[0].mds_pwe1_hdl, 500,
1370 NCSMDS_SCOPE_INTRACHASSIS, 1, svcids);
1371 if (rc == NCSCC_RC_SUCCESS) {
1372 printf("\nPossible to subscribe service 500 twice\n");
1373 FAIL = 1;
1374 }
1375
1376 rc = mds_service_cancel_subscription(gl_tet_vdest[0].mds_pwe1_hdl, 500,
1377 2, svcids);
1378 if (rc != NCSCC_RC_SUCCESS) {
1379 printf("\nFail to cancel subscription on service 500\n");
1380 FAIL = 1;
1381 }
1382
1383 // clean up
1384 // Uninstalling all the services on this VDEST
1385 for (id = gl_tet_vdest[0].svc_count - 1; id >= 0; id--)
1386 if (mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
1387 gl_tet_vdest[0].svc[id].svc_id) !=
1389 printf("\nFail mds_service_uninstall\n");
1390 FAIL = 1;
1391 }
1392
1393 // Destroying a MxN VDEST with id = 1001
1394 rc = destroy_vdest(1001);
1395 if (rc != NCSCC_RC_SUCCESS) {
1396 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
1397 FAIL = 1;
1398 }
1399
1400 test_validate(FAIL, 0);
1401}
1402
1404{
1405 int FAIL = 0;
1406 SaUint32T rc;
1407 int id;
1408 MDS_SVC_ID svcids[] = {600, 700};
1409 printf(
1410 "\nTest Case 5: Not able to Cancel the subscription which doesn't exist\n");
1411 // Creating a N-way VDEST with id =1001
1413 if (rc != NCSCC_RC_SUCCESS) {
1414 printf("\nCreating a N-way VDEST with id =1001\n");
1415 FAIL = 1;
1416 }
1417
1418 printf("\nInstalling the service 500,600,700 with CHASSIS scope");
1419 for (id = 500; id <= 700; id = id + 100) {
1420 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, id, 1,
1422 false) != NCSCC_RC_SUCCESS) {
1423 printf("Fail");
1424 FAIL = 1;
1425 }
1426 }
1427
1428 // Not able to Cancel the subscription which doesn't exist
1429 rc = mds_service_cancel_subscription(gl_tet_vdest[0].mds_pwe1_hdl, 500,
1430 2, svcids);
1431 if (rc == NCSCC_RC_SUCCESS) {
1432 printf(
1433 "\nPossible to Cancel the subscription which doesn't exist\n");
1434 FAIL = 1;
1435 }
1436
1437 // clean up
1438 // Uninstalling all the services on this VDEST
1439 for (id = gl_tet_vdest[0].svc_count - 1; id >= 0; id--)
1440 if (mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
1441 gl_tet_vdest[0].svc[id].svc_id) !=
1443 printf("\nFail mds_service_uninstall\n");
1444 FAIL = 1;
1445 }
1446
1447 // Destroying a MxN VDEST with id = 1001
1448 rc = destroy_vdest(1001);
1449 if (rc != NCSCC_RC_SUCCESS) {
1450 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
1451 FAIL = 1;
1452 }
1453
1454 test_validate(FAIL, 0);
1455}
1456
1458{
1459 int FAIL = 0;
1460 SaUint32T rc;
1461 int id;
1462 MDS_SVC_ID itself[] = {500};
1463 printf("\nTest Case 6: A service subscribing for Itself\n");
1464 // Creating a N-way VDEST with id =1001
1466 if (rc != NCSCC_RC_SUCCESS) {
1467 printf("\nCreating a N-way VDEST with id =1001\n");
1468 FAIL = 1;
1469 }
1470
1471 printf("\nInstalling the service 500,600,700 with CHASSIS scope");
1472 for (id = 500; id <= 700; id = id + 100) {
1473 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, id, 1,
1475 false) != NCSCC_RC_SUCCESS) {
1476 printf("Fail");
1477 FAIL = 1;
1478 }
1479 }
1480
1481 // A service subscribing for Itself
1482 rc = mds_service_subscribe(gl_tet_vdest[0].mds_pwe1_hdl, 500,
1483 NCSMDS_SCOPE_INTRACHASSIS, 1, itself);
1484 if (rc != NCSCC_RC_SUCCESS) {
1485 printf("\nFail to subscribe for itself (service 500)");
1486 FAIL = 1;
1487 }
1488
1489 rc = mds_service_cancel_subscription(gl_tet_vdest[0].mds_pwe1_hdl, 500,
1490 1, itself);
1491 if (rc != NCSCC_RC_SUCCESS) {
1492 printf("\nFail to cancel subscription");
1493 FAIL = 1;
1494 }
1495
1496 // clean up
1497 // Uninstalling all the services on this VDEST
1498 for (id = gl_tet_vdest[0].svc_count - 1; id >= 0; id--)
1499 if (mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
1500 gl_tet_vdest[0].svc[id].svc_id) !=
1502 printf("\nFail mds_service_uninstall\n");
1503 FAIL = 1;
1504 }
1505
1506 // Destroying a MxN VDEST with id = 1001
1507 rc = destroy_vdest(1001);
1508 if (rc != NCSCC_RC_SUCCESS) {
1509 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
1510 FAIL = 1;
1511 }
1512
1513 test_validate(FAIL, 0);
1514}
1515
1517{
1518 int FAIL = 0;
1519 SaUint32T rc;
1520 int id;
1521 MDS_SVC_ID svcids[] = {600, 700};
1522 printf(
1523 "\nTest Case 8: Able to subscribe when numer of services to be subscribed is = 0\n");
1524 // Creating a N-way VDEST with id =1001
1526 if (rc != NCSCC_RC_SUCCESS) {
1527 printf("\nCreating a N-way VDEST with id =1001\n");
1528 FAIL = 1;
1529 }
1530
1531 printf("\nInstalling the service 500,600,700 with CHASSIS scope");
1532 for (id = 500; id <= 700; id = id + 100) {
1533 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, id, 1,
1535 false) != NCSCC_RC_SUCCESS) {
1536 printf("Fail");
1537 FAIL = 1;
1538 }
1539 }
1540
1541 // Able to subscribe when numer of services to be subscribed is = 0\n");
1542 rc = mds_service_subscribe(gl_tet_vdest[0].mds_pwe1_hdl, 500,
1543 NCSMDS_SCOPE_INTRACHASSIS, 0, svcids);
1544 if (rc != NCSCC_RC_SUCCESS) {
1545 printf(
1546 "\nFail to subscribe when numer of services to be subscribed is = 0\n");
1547 FAIL = 1;
1548 }
1549
1550 rc = mds_service_cancel_subscription(gl_tet_vdest[0].mds_pwe1_hdl, 500,
1551 0, svcids);
1552 if (rc != NCSCC_RC_SUCCESS) {
1553 printf("\nFail to cancel subscription\n");
1554 FAIL = 1;
1555 }
1556
1557 // clean up
1558 // Uninstalling all the services on this VDEST
1559 for (id = gl_tet_vdest[0].svc_count - 1; id >= 0; id--)
1560 if (mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
1561 gl_tet_vdest[0].svc[id].svc_id) !=
1563 printf("\nFail mds_service_uninstall\n");
1564 FAIL = 1;
1565 }
1566
1567 // Destroying a MxN VDEST with id = 1001
1568 rc = destroy_vdest(1001);
1569 if (rc != NCSCC_RC_SUCCESS) {
1570 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
1571 FAIL = 1;
1572 }
1573
1574 test_validate(FAIL, 0);
1575}
1576
1578{
1579 int FAIL = 0;
1580 SaUint32T rc;
1581 int id;
1582 printf(
1583 "\nTest Case 9: Not able to subscribe when supplied services array is NULL\n");
1584 // Creating a N-way VDEST with id =1001
1586 if (rc != NCSCC_RC_SUCCESS) {
1587 printf("\nCreating a N-way VDEST with id =1001\n");
1588 FAIL = 1;
1589 }
1590
1591 printf("\nInstalling the service 500,600,700 with CHASSIS scope");
1592 for (id = 500; id <= 700; id = id + 100) {
1593 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, id, 1,
1595 false) != NCSCC_RC_SUCCESS) {
1596 printf("Fail");
1597 FAIL = 1;
1598 }
1599 }
1600
1601 // It shall not able to subscribe when supplied services array is NULL
1602 rc = mds_service_subscribe(gl_tet_vdest[0].mds_pwe1_hdl, 500,
1603 NCSMDS_SCOPE_INTRACHASSIS, 1, NULL);
1604 if (rc == NCSCC_RC_SUCCESS) {
1605 printf(
1606 "\nPossible to subscribe when supplied services array is NULL\n");
1607 FAIL = 1;
1608 }
1609
1610 // clean up
1611 // Uninstalling all the services on this VDEST
1612 for (id = gl_tet_vdest[0].svc_count - 1; id >= 0; id--)
1613 if (mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,
1614 gl_tet_vdest[0].svc[id].svc_id) !=
1616 printf("\nFail mds_service_uninstall\n");
1617 FAIL = 1;
1618 }
1619
1620 // Destroying a MxN VDEST with id = 1001
1621 rc = destroy_vdest(1001);
1622 if (rc != NCSCC_RC_SUCCESS) {
1623 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
1624 FAIL = 1;
1625 }
1626
1627 test_validate(FAIL, 0);
1628}
1629
1631{
1632 int FAIL = 0;
1633 SaUint32T rc;
1634 MDS_SVC_ID svcids[] = {600, 700};
1635 printf(
1636 "\nTest Case 7: A Service which is NOT installed; trying to subscribe for 600, 700\n");
1637 // Creating a N-way VDEST with id =1001
1639 if (rc != NCSCC_RC_SUCCESS) {
1640 printf("\nCreating a N-way VDEST with id =1001\n");
1641 FAIL = 1;
1642 }
1643
1644 if (mds_service_subscribe(gl_tet_vdest[0].mds_pwe1_hdl, 500,
1646 svcids) == NCSCC_RC_SUCCESS) {
1647 printf("\nFail\n");
1648 FAIL = 1;
1649 }
1650
1651 // Destroying a MxN VDEST with id = 1001
1652 rc = destroy_vdest(1001);
1653 if (rc != NCSCC_RC_SUCCESS) {
1654 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
1655 FAIL = 1;
1656 }
1657
1658 test_validate(FAIL, 0);
1659}
1660
1662{
1663 bool FAIL = false;
1664 SaUint32T rc;
1665 int id;
1666 MDS_SVC_ID svcids[] = {600, 700};
1667 printf(
1668 "\nTest Case 10: Cross check whether i_rem_svc_pvt_ver returned in service event callback, matches the service private sub-part version of the remote service (subscribee)\n");
1669 // Creating a N-way VDEST with id =1001
1671 if (rc != NCSCC_RC_SUCCESS) {
1672 printf("\nCreating a N-way VDEST with id =1001\n");
1673 FAIL = 1;
1674 }
1675
1676 // Cross check whether i_rem_svc_pvt_ver returned in service event
1677 // callback, matches the service private sub-part version of the remote
1678 // service (subscribee) Getting an ADEST handle
1680 printf("\nFail to get handle\n");
1681 FAIL = 1;
1682 }
1683
1684 gl_tet_adest.svc_count = 0; /*fix for blocking regression*/
1685 // Installing the services
1688 false) != NCSCC_RC_SUCCESS) {
1689 printf("\nFail to install service 500\n");
1690 FAIL = 1;
1691 }
1692 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, 600, 1,
1694 false) != NCSCC_RC_SUCCESS) {
1695 printf("\nFail to install service 600\n");
1696 FAIL = 1;
1697 }
1698 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, 700, 2,
1700 false) != NCSCC_RC_SUCCESS) {
1701 printf("\nFail to install service 700\n");
1702 FAIL = 1;
1703 }
1704
1705 // Subscribing for the services
1708 svcids) != NCSCC_RC_SUCCESS) {
1709 printf("\nFail to subscribe service 500\n");
1710 FAIL = 1;
1711 }
1712
1713 // verifying the rem svc ver from 600 and 700
1714 // Changing the role of vdest to active
1716 printf("\nFail to change role\n");
1717 FAIL = 1;
1718 }
1719 // Retrieving the events
1722 printf("\nRetrieve servive 500 Fail\n");
1723 FAIL = 1;
1724 }
1725
1726 // Verifying for the versions for UP event
1728 NCSMDS_UP)) != 1 ||
1730 NCSMDS_UP) != 1)) {
1731 printf("\nFail to verifying for the versions for UP event\n");
1732 FAIL = 1;
1733 }
1734 // Changing the role of vdest role to quiesced
1736 printf("\nFail to change the role of vdest role to quiesced\n");
1737 FAIL = 1;
1738 }
1739 // Retrieving the events
1742 printf("\nFail to retreive events\n");
1743 FAIL = 1;
1744 }
1746 NCSMDS_NO_ACTIVE)) != 1 ||
1748 NCSMDS_NO_ACTIVE) != 1)) {
1749 printf(
1750 "\nFail to verifying for the versions for NO_ACTIVE event\n");
1751 FAIL = 1;
1752 }
1753 // Changing the role of vdest role to standby
1755 printf("\nFail to change the role of vdest role to standby\n");
1756 FAIL = 1;
1757 }
1758 printf(" \n Sleeping for 3 minutes \n");
1759 sleep(200);
1760 // Retrieving the events
1763 printf("\nRetrieve Fail\n");
1764 FAIL = 1;
1765 }
1767 NCSMDS_DOWN)) != 1 ||
1769 NCSMDS_DOWN) != 1)) {
1770 printf("\nFail to verifying for the versions for DOWN event\n");
1771 FAIL = 1;
1772 }
1773
1774 printf("\tUninstalling 600 and 700\n");
1775 for (id = 600; id <= 700; id = id + 100) {
1776 if (mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl, id) !=
1778 printf("\nFail to uninstall service %d\n", id);
1779 FAIL = 1;
1780 }
1781 }
1782
1783 // Cancelling the subscription
1785 svcids) != NCSCC_RC_SUCCESS) {
1786 printf("\nFail cancel subscription 500\n");
1787 FAIL = 1;
1788 }
1791 printf("\nFail to uninstall service 500\n");
1792 FAIL = 1;
1793 }
1794
1795 // Destroying a MxN VDEST with id = 1001
1796 rc = destroy_vdest(1001);
1797 if (rc != NCSCC_RC_SUCCESS) {
1798 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
1799 FAIL = 1;
1800 }
1801
1802 test_validate(FAIL, 0);
1803}
1804
1806{
1807 bool FAIL = 0;
1808 SaUint32T rc;
1809 int id;
1810 MDS_SVC_ID svcids[] = {600, 700};
1811 // Creating a N-way VDEST with id =1001
1813 if (rc != NCSCC_RC_SUCCESS) {
1814 printf("\nCreating a N-way VDEST with id =1001\n");
1815 FAIL = 1;
1816 }
1817
1818 printf(
1819 "\nTest Case 11: When the Subscribee comes again with different sub-part version, cross check these changes are properly returned in the service event callback\n");
1820 printf("/nGetting an ADEST handle");
1822 printf("\nFail to get handle\n");
1823 FAIL = 1;
1824 }
1825
1826 gl_tet_adest.svc_count = 0; /*fix for blocking regression*/
1827 printf("\nInstalling the services");
1830 false) != NCSCC_RC_SUCCESS) {
1831 printf("\nFail to installing the servic 500s\n");
1832 FAIL = 1;
1833 }
1834 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, 600, 1,
1836 false) != NCSCC_RC_SUCCESS) {
1837 printf("\nFail to installing the servic 600s\n");
1838 FAIL = 1;
1839 }
1840 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, 700, 2,
1842 false) != NCSCC_RC_SUCCESS) {
1843 printf("\nFail to installing the servic 700s\n");
1844 FAIL = 1;
1845 }
1846 printf("\nSubscribing for the services");
1849 svcids) != NCSCC_RC_SUCCESS) {
1850 printf("\nFail to subscribing for the service 500\n");
1851 FAIL = 1;
1852 }
1853 sleep(1);
1854 /* verifying the rem svc ver from 600 and 700*/
1855 printf("\nChanging the role of vdest to active");
1857 printf("\nFail\n");
1858 FAIL = 1;
1859 }
1860 printf("\nRetrieving the events\n");
1861 sleep(1);
1864 printf("\nFail\n");
1865 FAIL = 1;
1866 }
1867
1868 printf("\nVerifying for the versions for UP event\n");
1870 NCSMDS_UP)) != 1 ||
1872 NCSMDS_UP) != 1)) {
1873 printf("\nFail\n");
1874 FAIL = 1;
1875 }
1876
1877 printf("\nUninstalling 600 and 700\n");
1878 for (id = 600; id <= 700; id = id + 100) {
1879 if (mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl, id) !=
1881 printf("\nFail\n");
1882 FAIL = 1;
1883 }
1884 }
1885 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, 600, 3,
1887 false) != NCSCC_RC_SUCCESS) {
1888 printf("\nFail\n");
1889 FAIL = 1;
1890 }
1891 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, 700, 4,
1893 false) != NCSCC_RC_SUCCESS) {
1894 printf("\nFail\n");
1895 FAIL = 1;
1896 }
1897 sleep(1);
1900 printf("Retrieve Fail\n");
1901 FAIL = 1;
1902 }
1903
1904 printf("\tVerifying for the versions for second UP event\n");
1906 NCSMDS_NEW_ACTIVE)) != 1 ||
1908 NCSMDS_NEW_ACTIVE) != 1)) {
1909 printf("\nFail\n");
1910 FAIL = 1;
1911 }
1912
1913 printf("\nCancelling the subscription\n");
1915 svcids) != NCSCC_RC_SUCCESS) {
1916 printf("\nFail\n");
1917 FAIL = 1;
1918 }
1919 printf("\nUninstalling 600 and 700\n");
1920 for (id = 600; id <= 700; id = id + 100) {
1921 if (mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl, id) !=
1923 printf("\nFail\n");
1924 FAIL = 1;
1925 }
1926 }
1927
1930 printf("\nFail\n");
1931 FAIL = 1;
1932 }
1933 // Destroying a MxN VDEST with id = 1001
1934 rc = destroy_vdest(1001);
1935 if (rc != NCSCC_RC_SUCCESS) {
1936 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
1937 FAIL = 1;
1938 }
1939
1940 test_validate(FAIL, 0);
1941}
1942
1944{
1945 int FAIL = 0;
1946 SaUint32T rc;
1947 int i;
1948 MDS_SVC_ID svc_id_sixhd[] = {600};
1949 // Creating a N-way VDEST with id =1001
1951 if (rc != NCSCC_RC_SUCCESS) {
1952 printf("\nCreating a N-way VDEST with id =1001\n");
1953 FAIL = 1;
1954 }
1955
1956 printf(
1957 "\nTest case 12: In the NO_ACTIVE event notification, the remote service subpart version is set to the last active instance.s remote-service sub-part version\n");
1958 printf("\nGetting an ADEST handle\n");
1960 printf("\nFail\n");
1961 FAIL = 1;
1962 }
1963
1964 gl_tet_adest.svc_count = 0; /*fix for blocking regression*/
1965 printf("\nAction: Creating a N-way VDEST with id =1001\n");
1968 printf("\nFail\n");
1969 FAIL = 1;
1970 }
1971
1972 printf("\nAction: Installing the services\n");
1975 false) != NCSCC_RC_SUCCESS) {
1976 printf("\nFail\n");
1977 FAIL = 1;
1978 }
1979 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl, 600, 1,
1981 false) != NCSCC_RC_SUCCESS) {
1982 printf("\nFail\n");
1983 FAIL = 1;
1984 }
1985 if (mds_service_install(gl_tet_vdest[1].mds_pwe1_hdl, 600, 2,
1987 false) != NCSCC_RC_SUCCESS) {
1988 printf("\nFail\n");
1989 FAIL = 1;
1990 }
1991
1992 printf("\nAction: Subscribing for the services\n");
1995 svc_id_sixhd) != NCSCC_RC_SUCCESS) {
1996 printf("\nFail\n");
1997 FAIL = 1;
1998 }
1999 /* verifying the rem svc ver from 600 and 700*/
2000 printf("\nAction: Changing the role of vdest 1001 to active\n");
2002 printf("\nFail\n");
2003 FAIL = 1;
2004 }
2005
2006 printf("\nAction: Retrieving the events\n");
2009 printf("Retrieve Fail\n");
2010 FAIL = 1;
2011 }
2012
2013 printf("\nAction: Verifying for the versions for UP event\n");
2015 NCSMDS_UP) != 1)
2016
2017 {
2018 printf("\nFail\n");
2019 FAIL = 1;
2020 }
2021
2022 printf("\nAction: Changing the role of vdest 1002 to active\n");
2024 printf("\nFail\n");
2025 FAIL = 1;
2026 }
2027
2028 printf("\tChanging the role of vdest 1001 to standby\n");
2030 printf("\nFail\n");
2031 FAIL = 1;
2032 }
2033
2034 printf("\nAction: Changing the role of vdest 1002 to standby\n");
2036 printf("\nFail\n");
2037 FAIL = 1;
2038 }
2039
2040 sleep(1);
2043 printf("Retrieve Fail\n");
2044 FAIL = 1;
2045 }
2046 printf("\nAction: Verifying for the versions for NO ACTIVE event\n");
2048 NCSMDS_NO_ACTIVE) != 1)
2049
2050 {
2051 printf("\nFail\n");
2052 FAIL = 1;
2053 }
2054
2055 printf("\nAction: Uninstalling 600 \n");
2056 for (i = 0; i <= 1; i++) {
2057 if (mds_service_uninstall(gl_tet_vdest[i].mds_pwe1_hdl, 600) !=
2059
2060 {
2061 printf("\nFail\n");
2062 FAIL = 1;
2063 }
2064 }
2065
2066 printf("\nAction: Cancelling the subscription\n");
2068 svc_id_sixhd) != NCSCC_RC_SUCCESS) {
2069 printf("\nFail\n");
2070 FAIL = 1;
2071 }
2074 printf("\nFail\n");
2075 FAIL = 1;
2076 }
2077 printf("\nAction: Destroying the VDEST 1002\n");
2078 if (destroy_vdest(1002) != NCSCC_RC_SUCCESS) {
2079 printf("\nFail\n");
2080 FAIL = 1;
2081 }
2082
2083 // Destroying a MxN VDEST with id = 1001
2084 rc = destroy_vdest(1001);
2085 if (rc != NCSCC_RC_SUCCESS) {
2086 printf("\nFail to Destroying a MxN VDEST with id = 1001\n");
2087 FAIL = 1;
2088 }
2089
2090 test_validate(FAIL, 0);
2091}
2092
2094{
2095 MDS_SVC_ID svcids[] = {600, 700};
2096 printf(" Inside Thread\n");
2098 svcids) != NCSCC_RC_SUCCESS) {
2099 printf("Cancel Failed\n");
2100 }
2101}
2102
2104{
2105 printf(" Inside Thread\n");
2108 printf("Retrieve Failed\n");
2109 }
2110}
2111
2113{
2114 int FAIL = 0;
2115 int id;
2116
2117 printf("\nGetting an ADEST handle\n");
2119 printf("\nFail\n");
2120 FAIL = 1;
2121 }
2122
2123 gl_tet_adest.svc_count = 0; /*fix for blocking regression*/
2124
2125 printf("\nInstalling the services 500,600,700 with CHASSIS scope\n");
2126 for (id = 500; id <= 700; id = id + 100) {
2129 false) != NCSCC_RC_SUCCESS) {
2130 printf("\nFail\n");
2131 FAIL = 1;
2132 }
2133 }
2134
2135 if (FAIL == 1)
2136 return false;
2137 else
2138 return true;
2139}
2140
2142{
2143 int id;
2144 printf("\nUninstalling all the services on this ADESt\n");
2145 for (id = gl_tet_adest.svc_count - 1; id >= 0; id--) {
2149 printf("Adest Svc Retrieve Fail\n");
2150 }
2152 gl_tet_adest.svc[id].svc_id) !=
2154 printf("\nFail mds_service_uninstall\n");
2155 }
2156 }
2157}
2158
2160{
2161 int FAIL = 0;
2162 MDS_SVC_ID svcids[] = {600, 700};
2163
2164 printf(
2165 "Test Case 1: 500 Subscription to:600,700 where Install scope = Subscription scope\n");
2166 if (prepare_ADEST_tc() == false)
2167 FAIL = 1;
2168
2169 printf("\nAction: Retrieve only ONE event\n");
2172 svcids) != NCSCC_RC_SUCCESS) {
2173 printf("\nFail\n");
2174 FAIL = 1;
2175 } else {
2176 printf("\nAction: Retrieve only ONE event\n");
2179 printf("Fail, retrieve ONE\n");
2180 FAIL = 1;
2181 } else
2182 printf("\nSuccess\n");
2183
2184 printf("\nAction: Retrieve ALL event\n");
2187 printf("Retrieve ALL FAIL\n");
2188 FAIL = 1;
2189 } else
2190 printf("\nSuccess\n");
2191
2192 printf("\nAction: Cancel subscription 500\n");
2194 500, 2, svcids) !=
2196 printf("\nFail\n");
2197 FAIL = 1;
2198 }
2199 printf("\nSuccess\n");
2200 }
2201
2202 // clean up
2204
2205 test_validate(FAIL, 0);
2206}
2207
2209{
2210 int FAIL = 0;
2211 MDS_SVC_ID svcids[] = {600, 700};
2212
2213 if (prepare_ADEST_tc() == false)
2214 FAIL = 1;
2215
2216 /*install scope > subscribe scope*/
2217 printf(
2218 "Test Case 2: 500 Subscription to:600,700 where Install scope > Subscription scope (NODE)\n");
2219
2220 printf("\nAction: Subscribe srv 500\n");
2223 svcids) != NCSCC_RC_SUCCESS) {
2224 printf("\nFail\n");
2225 FAIL = 1;
2226 } else {
2227 printf("\nAction: Retrieve with Invalid NULL/0 PWE Handle\n");
2228 if (mds_service_retrieve((MDS_HDL)(long)NULL, 500,
2230 printf("\nFail\n");
2231 FAIL = 1;
2232 }
2235 printf("\nFail\n");
2236 FAIL = 1;
2237 }
2238 printf(
2239 "\nAction: Not able to Retrieve Events for a Service which is not installed\n");
2242 printf("\nFail\n");
2243 FAIL = 1;
2244 }
2245
2248 printf("\nFail to mds_service_retrieve\n");
2249 FAIL = 1;
2250 }
2251
2253 500, 2, svcids) !=
2255 printf("\nFail\n");
2256 FAIL = 1;
2257 }
2258 printf("\nSuccess\n");
2259 }
2260 // clean up
2262
2263 test_validate(FAIL, 0);
2264}
2265
2267{
2268 int FAIL = 0;
2269 MDS_SVC_ID svcids[] = {600, 700};
2270
2271 if (prepare_ADEST_tc() == false)
2272 FAIL = 1;
2273
2274 /*install scope < subscribe scope*/
2275 printf(
2276 "\nTest Case 3: Not able to: 500 Subscription to:600,700 where install scope < Subscription scope(PWE)\n");
2277 printf("\nAction: Subscribe srv 500\n");
2280 svcids) == NCSCC_RC_SUCCESS) {
2281 printf("\nFail\n");
2282 FAIL = 1;
2283 } else
2284 printf("\nSuccess\n");
2285
2286 // clean up
2288
2289 test_validate(FAIL, 0);
2290}
2291
2293{
2294 int FAIL = 0;
2295 MDS_SVC_ID svcids[] = {600, 700};
2296
2297 if (prepare_ADEST_tc() == false)
2298 FAIL = 1;
2299
2300 printf(
2301 "\nTest Case 4: Not able to subscribe again:500 Subscribing to service 600\n");
2302
2303 printf("\nAction: Subscribe srv 500\n");
2306 svcids) != NCSCC_RC_SUCCESS) {
2307 printf("\nFail\n");
2308 FAIL = 1;
2309 }
2310
2311 printf("\nAction: Subscribe srv 500 again\n");
2314 svcids) == NCSCC_RC_SUCCESS) {
2315 printf("\nFail\n");
2316 FAIL = 1;
2317 } else {
2318 printf("\nAction: Retreive service\n");
2321 printf("\nFail to mds_service_retrieve\n");
2322 FAIL = 1;
2323 }
2324
2325 printf("\nAction: Cancel subscription\n");
2327 500, 2, svcids) !=
2329 printf("\nFail\n");
2330 FAIL = 1;
2331 }
2332
2333 printf("\nSuccess\n");
2334 }
2335
2336 // clean up
2338
2339 test_validate(FAIL, 0);
2340}
2341
2343{
2344 int FAIL = 0;
2345 MDS_SVC_ID svcids[] = {600, 700};
2346
2347 if (prepare_ADEST_tc() == false)
2348 FAIL = 1;
2349
2350 printf(
2351 "\nTest Case 5: Not able to Cancel the subscription which doesn't exist\n");
2353 svcids) == NCSCC_RC_SUCCESS) {
2354 printf("\nFail\n");
2355 FAIL = 1;
2356 } else
2357 printf("\nSuccess\n");
2358
2359 // clean up
2361
2362 test_validate(FAIL, 0);
2363}
2364
2366{
2367 int FAIL = 0;
2368 MDS_SVC_ID itself[] = {500};
2369
2370 if (prepare_ADEST_tc() == false)
2371 FAIL = 1;
2372 printf("\nTest Case 6: A service subscribing for Itself\n");
2373 printf("\n Action: Subscribe srv 500\n");
2376 itself) != NCSCC_RC_SUCCESS) {
2377 printf("\nFail\n");
2378 FAIL = 1;
2379 } else {
2380 printf(
2381 "\n Action: Not able to Retrieve with Invalid Dispatch Flag\n");
2384 printf("\nFail\n");
2385 FAIL = 1;
2386 }
2387 printf("\n Action: Retreive service 500\n");
2390 printf("\nFail mds_service_retrieve\n");
2391 FAIL = 1;
2392 }
2393
2394 printf("\n Action: Cancel subscription 500\n");
2396 500, 1, itself) !=
2398 printf("\nFail\n");
2399 FAIL = 1;
2400 }
2401 printf("\nSuccess\n");
2402 }
2403
2404 // clean up
2406
2407 test_validate(FAIL, 0);
2408}
2409
2411{
2412 int FAIL = 0;
2413 MDS_SVC_ID svcids[] = {600, 700};
2414
2415 printf(
2416 "\nTest Case 7 : A Service which is NOT installed; trying to subscribe for 600, 700\n");
2419 svcids) == NCSCC_RC_SUCCESS) {
2420 printf("\nFail\n");
2421 FAIL = 1;
2422 }
2423
2424 test_validate(FAIL, 0);
2425}
2426
2428{
2429 int FAIL = 0;
2430 MDS_SVC_ID svcids[] = {600, 700};
2431
2432 if (prepare_ADEST_tc() == false)
2433 FAIL = 1;
2434
2435 /*install scope = subscribe scope*/
2436 printf(
2437 "\nTest Case 8: 500 Subscription to:600,700 Cancel this Subscription in a seperate thread\n");
2440 svcids) != NCSCC_RC_SUCCESS) {
2441 printf("\nFail\n");
2442 FAIL = 1;
2443 } else {
2446 printf("Retrieve Fail\n");
2447 FAIL = 1;
2448 }
2449 printf("\nAction: Cancel in a seperate thread\n");
2453 printf("\nTask has been Created\n");
2454 fflush(stdout);
2455 }
2456 fflush(stdout);
2457 printf("\nAction: Release the Cancel Thread\n");
2460 printf("\nTASK is released\n");
2461 }
2462 pthread_mutex_lock(&gl_mutex);
2463 if (gl_tet_adest.svc[0].subscr_count) {
2464 printf("Cancel Fail\n");
2465 FAIL = 1;
2466 } else
2467 printf("\nSuccess\n");
2468 pthread_mutex_unlock(&gl_mutex);
2469 }
2470
2471 // clean up
2473
2474 test_validate(FAIL, 0);
2475}
2476
2478{
2479 int FAIL = 0;
2480 MDS_SVC_ID one[] = {600};
2481 MDS_SVC_ID two[] = {700};
2482 MDS_SVC_ID svcids[] = {600, 700};
2483
2484 if (prepare_ADEST_tc() == false)
2485 FAIL = 1;
2486
2487 printf(
2488 "\nTest Case 9: 500 Subscription to:600,700 in two seperate Subscription calls but Cancels both in a single cancellation call\n");
2489 printf("\nAction: Subscribe 500 to 600\n");
2492 one) != NCSCC_RC_SUCCESS) {
2493 printf("\nFail\n");
2494 FAIL = 1;
2495 }
2496 printf("\nAction: Subscribe 500 to 700\n");
2499 two) != NCSCC_RC_SUCCESS) {
2500 printf("\nFail\n");
2501 FAIL = 1;
2502 } else {
2503 printf("\nAction: Retreive three times, third shall fail\n");
2506 printf("\nFail mds_service_retrieve\n");
2507 FAIL = 1;
2508 }
2509
2512 printf("\nFail mds_service_retrieve\n");
2513 FAIL = 1;
2514 }
2515
2518 printf("Retrieve Fail\n");
2519 FAIL = 1;
2520 }
2521
2522 printf("\nAction: Cancel subscription\n");
2524 500, 2, svcids) !=
2526 printf("\nFail\n");
2527 FAIL = 1;
2528 }
2529 printf("\nSuccess\n");
2530 }
2531
2532 // clean up
2534
2535 test_validate(FAIL, 0);
2536}
2537
2539{
2540 int FAIL = 0;
2541 MDS_SVC_ID svcids[] = {600, 700};
2542
2543 if (prepare_ADEST_tc() == false)
2544 FAIL = 1;
2545
2546 printf(
2547 "\nTest Case 10: 500 Subscription to:600,700 Cancel this Subscription in a seperate thread\n");
2550 svcids) != NCSCC_RC_SUCCESS) {
2551 printf("\nFail\n");
2552 FAIL = 1;
2553 } else {
2554 printf("\nAction: Retrieve in a seperate thread\n");
2555 /*Retrieve thread*/
2559 printf("\nTask has been Created\n");
2560 fflush(stdout);
2561 }
2562 fflush(stdout);
2563 printf("\nAction: Release the Retrieve Thread\n");
2566 printf("\nTASK is released\n");
2567 }
2568
2569 printf("\nAction: Cancel subscription 500\n");
2571 500, 2, svcids) !=
2573 printf("\nFail\n");
2574 FAIL = 1;
2575 }
2576 printf("\nSuccess\n");
2577 }
2578
2579 // clean up
2581
2582 test_validate(FAIL, 0);
2583}
2584
2586{
2587 int FAIL = 0;
2588 int id;
2589 MDS_SVC_ID svcids[] = {600, 700};
2590
2591 if (prepare_ADEST_tc() == false)
2592 FAIL = 1;
2593
2594 printf(
2595 "\nTest Case 11: Cross check whether i_rem_svc_pvt_ver returned in service event callback, matches the service private sub-part version of the remote service (subscribee)\n");
2598 printf("\nFail mds_service_uninstall\n");
2599 FAIL = 1;
2600 }
2601 printf("\nAction: Installing serive 700\n");
2604 false) != NCSCC_RC_SUCCESS) {
2605 printf("Fail \n");
2606 FAIL = 1;
2607 }
2608 printf("\nAction: Subscribing for the services\n");
2611 svcids) != NCSCC_RC_SUCCESS) {
2612 printf("Fail \n");
2613 FAIL = 1;
2614 }
2615 sleep(1);
2616 printf("\nAction: Retreive the services\n");
2619 printf("Retrieve Fail\n");
2620 FAIL = 1;
2621 }
2622
2623 printf("\nAction: Verifying the svc pvt version for UP events\n");
2625 NCSMDS_UP)) != 1 ||
2627 NCSMDS_UP) != 1)) {
2628 printf("\nFail\n");
2629 FAIL = 1;
2630 }
2631 printf("\nAction: Uninstalling 600 and 700\n");
2632 for (id = 600; id <= 700; id = id + 100) {
2635 printf("\nFail\n");
2636 FAIL = 1;
2637 }
2638 }
2639 sleep(1);
2642 printf("Retrieve Fail\n");
2643 FAIL = 1;
2644 }
2645 printf("\nAction: Verifying the svc pvt version for DOWN events\n");
2646
2648 NCSMDS_DOWN) != 1 ||
2650 NCSMDS_DOWN) != 1) {
2651 printf("\nFail\n");
2652 FAIL = 1;
2653 }
2654
2655 printf("\nAction: Cancelling the subscription\n");
2657 svcids) != NCSCC_RC_SUCCESS) {
2658 printf("\nFail\n");
2659 FAIL = 1;
2660 }
2661 // clean up
2663
2664 test_validate(FAIL, 0);
2665}
2666
2667uint32_t tet_initialise_setup(bool fail_no_active_sends)
2668{
2669 int i, FAIL = 0;
2670 gl_vdest_indx = 0;
2671 printf(
2672 "/ntet_initialise_setup: Get an ADEST handle,Create PWE=2 on ADEST,Install EXTMIN and INTMIN svc\
2673 on ADEST,Install INTMIN,EXTMIN services on ADEST's PWE=2,\nCreate VDEST 100\
2674 and VDEST 200,Change the role of VDEST 200 to ACTIVE, \n\tInstall EXTMIN \
2675 service on VDEST 100,Install INTMIN, EXTMIN services on VDEST 200 \n");
2677 printf("\nFail adest_get_handle\n");
2678 FAIL = 1;
2679 }
2680
2682 printf("\nFail\n");
2683 FAIL = 1;
2684 }
2687 printf("\nFail\n");
2688 FAIL = 1;
2689 }
2690
2693 printf("\nFail\n");
2694 FAIL = 1;
2695 }
2696
2699 printf("\nFail\n");
2700 FAIL = 1;
2701 }
2706 true, fail_no_active_sends) != NCSCC_RC_SUCCESS) {
2707 printf("\nFail\n");
2708 FAIL = 1;
2709 }
2710
2714 NCSMDS_SCOPE_NONE, true,
2715 fail_no_active_sends) !=
2717 printf("\nFail\n");
2718 FAIL = 1;
2719 }
2720
2721 if (mds_service_install(gl_tet_vdest[0].mds_pwe1_hdl,
2723 NCSMDS_SCOPE_NONE, true,
2724 fail_no_active_sends) != NCSCC_RC_SUCCESS) {
2725 printf("\nFail\n");
2726 FAIL = 1;
2727 }
2728
2729 if (mds_service_install(gl_tet_vdest[1].mds_pwe1_hdl,
2731 NCSMDS_SCOPE_NONE, true,
2732 fail_no_active_sends) != NCSCC_RC_SUCCESS) {
2733 printf("\nFail\n");
2734 FAIL = 1;
2735 }
2736 if (mds_service_install(gl_tet_vdest[1].mds_pwe1_hdl,
2738 NCSMDS_SCOPE_NONE, true,
2739 fail_no_active_sends) != NCSCC_RC_SUCCESS) {
2740 printf("\nFail\n");
2741 FAIL = 1;
2742 }
2743
2744 return FAIL;
2745}
2746
2748{
2749 int i, id, FAIL = 0;
2750 printf("\tUninstalling the services on both VDESTs and ADEST\n");
2751 printf("\n UnInstalling the Services on both the VDESTs\n");
2752 for (i = gl_vdest_indx - 1; i >= 0; i--) {
2753 for (id = gl_tet_vdest[i].svc_count - 1; id >= 0; id--) {
2754 if (mds_service_retrieve(gl_tet_vdest[i].mds_pwe1_hdl,
2755 gl_tet_vdest[i].svc[id].svc_id,
2756 SA_DISPATCH_ALL) !=
2758 printf("Fail mds_service_retrieve\n");
2759 FAIL = 1;
2760 }
2761 if (gl_rcvdmsginfo.msg) {
2762 free(gl_rcvdmsginfo.msg);
2763 gl_rcvdmsginfo.msg = NULL;
2764 }
2766 gl_tet_vdest[i].mds_pwe1_hdl,
2767 gl_tet_vdest[i].svc[id].svc_id) !=
2769 printf("Fail Vdest Svc Uninstall\n");
2770 FAIL = 1;
2771 }
2772 }
2773 }
2774 fflush(stdout);
2775 printf("\nDestroying the VDESTS\n");
2776 printf("\tDestroying both the VDESTs and PWE=2 on ADEST\n");
2777 for (i = gl_vdest_indx - 1; i >= 0; i--) {
2778 /*changing its role to Standby*/
2779 if (vdest_change_role(gl_tet_vdest[i].vdest,
2781 printf("\nFail\n");
2782 }
2783 /*destroy all VDESTs */
2784 if (destroy_vdest(gl_tet_vdest[i].vdest) != NCSCC_RC_SUCCESS) {
2785 printf("VDEST DESTROY Fail\n");
2786 FAIL = 1;
2787 }
2788 }
2789#if 1
2790 /*Uninstalling the 2000/INTMIN service on PWE1 ADEST*/
2795 printf("Adest Svc Retrieve Fail\n");
2796 FAIL = 1;
2797 }
2798 if (gl_rcvdmsginfo.msg) {
2799 free(gl_rcvdmsginfo.msg);
2800 gl_rcvdmsginfo.msg = NULL;
2801 }
2804 printf("Adest Svc Uninstall Fail\n");
2805 FAIL = 1;
2806 }
2807 }
2808 /*Uninstalling the 2000/INTMIN on PWE2 of ADEST*/
2809 printf("\n ADEST : PWE 2 : Uninstalling Services 2000/INTMIN\n");
2814 printf("Adest Svc PWE 2 Retrieve Fail\n");
2815 FAIL = 1;
2816 }
2817 if (gl_rcvdmsginfo.msg) {
2818 free(gl_rcvdmsginfo.msg);
2819 gl_rcvdmsginfo.msg = NULL;
2820 }
2823 printf("Adest Svc PWE 2 Uninstall Fail\n");
2824 FAIL = 1;
2825 }
2826 }
2827#endif
2828 printf("\nADEST PWE2 Destroyed\n");
2831 printf("ADEST PWE2 Destroy Fail\n");
2832 FAIL = 1;
2833 }
2834
2835 return FAIL;
2836}
2837
2839{
2840 int FAIL = 0;
2842 gl_vdest_indx = 0;
2843
2844 char tmp[] = " Hi Receiver ";
2845 TET_MDS_MSG *mesg;
2846 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
2847 memset(mesg, 0, sizeof(TET_MDS_MSG));
2848 memcpy(mesg->send_data, tmp, sizeof(tmp));
2849 mesg->send_len = sizeof(tmp);
2850
2851 /*start up*/
2852 if (tet_initialise_setup(false)) {
2853 printf("\nSetup Initialisation has Failed \n");
2854 FAIL = 1;
2855 } else {
2856 printf(
2857 "\nTest Case 1: Send Low, Medium, High and Very High Priority messages to Svc EXTMIN on Active Vdest in sequence\n");
2858
2859 printf("\nAction: Subscribe\n");
2862 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
2863 printf("\nFail\n");
2864 FAIL = 1;
2865 }
2866 printf("\nAction: Retreive\n");
2870 printf("\nFail\n");
2871 FAIL = 1;
2872 }
2873
2874 printf("\nAction: Send LOW\n");
2875 if (mds_just_send(
2879 printf("\nFail\n");
2880 FAIL = 1;
2881 } else {
2882 printf("LOW Success\n");
2883 }
2884
2885 printf("\nAction: Send MEDIUM\n");
2886 if (mds_just_send(
2890 printf("\nFail\n");
2891 FAIL = 1;
2892 } else {
2893 printf("MEDIUM Success\n");
2894 }
2895
2896 printf("\nAction: Send HIGH\n");
2897 if (mds_just_send(
2901 printf("\nFail\n");
2902 FAIL = 1;
2903 } else {
2904 printf("HIGH Success\n");
2905 }
2906
2907 printf("\nAction: Send VERY HIGH\n");
2908 if (mds_just_send(
2912 mesg) != NCSCC_RC_SUCCESS) {
2913 printf("\nFail\n");
2914 FAIL = 1;
2915 } else {
2916 printf("VERY HIGH Success\n");
2917 }
2918
2919 printf("\nCancelling the subscription\n");
2922 1, svcids) != NCSCC_RC_SUCCESS) {
2923 printf("\nFail\n");
2924 FAIL = 1;
2925 }
2926 }
2927
2928 /*clean up*/
2929 if (tet_cleanup_setup()) {
2930 printf("\nSetup Clean Up has Failed \n");
2931 FAIL = 1;
2932 }
2933
2934 free(mesg);
2935 test_validate(FAIL, 0);
2936}
2937
2939{
2940 int FAIL = 0;
2942 gl_vdest_indx = 0;
2943
2944 char tmp[] = " Hi Receiver ";
2945 TET_MDS_MSG *mesg;
2946 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
2947 memset(mesg, 0, sizeof(TET_MDS_MSG));
2948 memcpy(mesg->send_data, tmp, sizeof(tmp));
2949 mesg->send_len = sizeof(tmp);
2950
2951 /*start up*/
2952 if (tet_initialise_setup(false)) {
2953 printf("\nSetup Initialisation has Failed \n");
2954 FAIL = 1;
2955 } else {
2956 printf(
2957 "\nTest Case 2: Not able to send a message to Svc EXTMIN with Invalid pwe handle\n");
2958 /*--------------------------------------------------------------------*/
2961 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
2962 printf("\nFail\n");
2963 FAIL = 1;
2964 }
2968 printf("\nFail\n");
2969 FAIL = 1;
2970 }
2971
2976 mesg) == NCSCC_RC_SUCCESS) {
2977 printf("\nFail\n");
2978 FAIL = 1;
2979 }
2980
2981 printf("\nCancelling the subscription\n");
2984 1, svcids) != NCSCC_RC_SUCCESS) {
2985 printf("\nFail\n");
2986 FAIL = 1;
2987 }
2988 }
2989
2990 /*clean up*/
2991 if (tet_cleanup_setup()) {
2992 printf("\nSetup Clean Up has Failed \n");
2993 FAIL = 1;
2994 }
2995
2996 free(mesg);
2997 test_validate(FAIL, 0);
2998}
2999
3001{
3002 int FAIL = 0;
3004 gl_vdest_indx = 0;
3005
3006 char tmp[] = " Hi Receiver ";
3007 TET_MDS_MSG *mesg;
3008 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
3009 memset(mesg, 0, sizeof(TET_MDS_MSG));
3010 memcpy(mesg->send_data, tmp, sizeof(tmp));
3011 mesg->send_len = sizeof(tmp);
3012
3013 /*start up*/
3014 if (tet_initialise_setup(false)) {
3015 printf("\nSetup Initialisation has Failed \n");
3016 FAIL = 1;
3017 } else {
3018 printf(
3019 "\nTest Case 3: Not able to send a message to Svc EXTMIN with NULL pwe handle\n");
3020 /*--------------------------------------------------------------------*/
3023 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
3024 printf("\nFail\n");
3025 FAIL = 1;
3026 }
3030 printf("\nFail\n");
3031 FAIL = 1;
3032 }
3033
3034 if (mds_just_send(
3038 printf("\nFail\n");
3039 FAIL = 1;
3040 }
3041 printf("\nCancelling the subscription\n");
3044 1, svcids) != NCSCC_RC_SUCCESS) {
3045 printf("\nFail\n");
3046 FAIL = 1;
3047 }
3048 }
3049
3050 /*clean up*/
3051 if (tet_cleanup_setup()) {
3052 printf("\nSetup Clean Up has Failed \n");
3053 FAIL = 1;
3054 }
3055
3056 free(mesg);
3057 test_validate(FAIL, 0);
3058}
3059
3061{
3062 int FAIL = 0;
3064 gl_vdest_indx = 0;
3065
3066 char tmp[] = " Hi Receiver ";
3067 TET_MDS_MSG *mesg;
3068 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
3069 memset(mesg, 0, sizeof(TET_MDS_MSG));
3070 memcpy(mesg->send_data, tmp, sizeof(tmp));
3071 mesg->send_len = sizeof(tmp);
3072
3073 /*start up*/
3074 if (tet_initialise_setup(false)) {
3075 printf("\nSetup Initialisation has Failed \n");
3076 FAIL = 1;
3077 } else {
3078 printf(
3079 "\nTest Case 4: Not able to send a message to Svc EXTMIN with Wrong DEST\n");
3080 /*--------------------------------------------------------------------*/
3083 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
3084 printf("\nFail\n");
3085 FAIL = 1;
3086 }
3090 printf("\nFail\n");
3091 FAIL = 1;
3092 }
3093
3094 if (mds_just_send(
3097 mesg) == NCSCC_RC_SUCCESS) {
3098 printf("\nFail\n");
3099 FAIL = 1;
3100 }
3101
3102 printf("\nCancelling the subscription\n");
3105 1, svcids) != NCSCC_RC_SUCCESS) {
3106 printf("\nFail\n");
3107 FAIL = 1;
3108 }
3109 }
3110
3111 /*clean up*/
3112 if (tet_cleanup_setup()) {
3113 printf("\nSetup Clean Up has Failed \n");
3114 FAIL = 1;
3115 }
3116
3117 free(mesg);
3118 test_validate(FAIL, 0);
3119}
3120
3122{
3123 int FAIL = 0;
3125 gl_vdest_indx = 0;
3126
3127 char tmp[] = " Hi Receiver ";
3128 TET_MDS_MSG *mesg;
3129 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
3130 memset(mesg, 0, sizeof(TET_MDS_MSG));
3131 memcpy(mesg->send_data, tmp, sizeof(tmp));
3132 mesg->send_len = sizeof(tmp);
3133
3134 /*start up*/
3135 if (tet_initialise_setup(false)) {
3136 printf("\nSetup Initialisation has Failed \n");
3137 FAIL = 1;
3138 } else {
3139 printf(
3140 "\nTest Case 5: Not able to send a message to service which is Not installed\n");
3141 /*--------------------------------------------------------------------*/
3144 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
3145 printf("\nFail\n");
3146 FAIL = 1;
3147 }
3151 printf("\nFail\n");
3152 FAIL = 1;
3153 }
3157 mesg) == NCSCC_RC_SUCCESS) {
3158 printf("\nFail\n");
3159 FAIL = 1;
3160 }
3161 printf("\nCancelling the subscription\n");
3164 1, svcids) != NCSCC_RC_SUCCESS) {
3165 printf("\nFail\n");
3166 FAIL = 1;
3167 }
3168 }
3169
3170 /*clean up*/
3171 if (tet_cleanup_setup()) {
3172 printf("\nSetup Clean Up has Failed \n");
3173 FAIL = 1;
3174 }
3175
3176 free(mesg);
3177 test_validate(FAIL, 0);
3178}
3179
3181{
3182 int FAIL = 0;
3183 int id;
3185 gl_vdest_indx = 0;
3186
3187 char tmp[] = " Hi Receiver ";
3188 TET_MDS_MSG *mesg;
3189 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
3190 memset(mesg, 0, sizeof(TET_MDS_MSG));
3191 memcpy(mesg->send_data, tmp, sizeof(tmp));
3192 mesg->send_len = sizeof(tmp);
3193
3194 /*start up*/
3195 if (tet_initialise_setup(false)) {
3196 printf("\nSetup Initialisation has Failed \n");
3197 FAIL = 1;
3198 } else {
3199 printf(
3200 "\nTest Case 6: Able to send a messages 1000 times to Svc 2000 on Active Vdest\n");
3201 /*--------------------------------------------------------------------*/
3204 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
3205 printf("\nFail\n");
3206 FAIL = 1;
3207 }
3211 printf("\nFail\n");
3212 FAIL = 1;
3213 }
3214
3215 for (id = 1; id <= 1000; id++)
3221 mesg) != NCSCC_RC_SUCCESS) {
3222 printf("\nFail\n");
3223 FAIL = 1;
3224 break;
3225 }
3226 if (id == 1001) {
3227 printf("\nALL THE MESSAGES GOT DELIVERED\n");
3228 sleep(1);
3229 }
3230
3231 printf("\nCancelling the subscription\n");
3234 1, svcids) != NCSCC_RC_SUCCESS) {
3235 printf("\nFail\n");
3236 FAIL = 1;
3237 }
3238 }
3239
3240 /*clean up*/
3241 if (tet_cleanup_setup()) {
3242 printf("\nSetup Clean Up has Failed \n");
3243 FAIL = 1;
3244 }
3245
3246 free(mesg);
3247 test_validate(FAIL, 0);
3248}
3249
3251{
3252 int FAIL = 0;
3255 gl_vdest_indx = 0;
3256
3257 char tmp[] = " Hi Receiver ";
3258 TET_MDS_MSG *mesg;
3259 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
3260 memset(mesg, 0, sizeof(TET_MDS_MSG));
3261 memcpy(mesg->send_data, tmp, sizeof(tmp));
3262 mesg->send_len = sizeof(tmp);
3263
3264 /*start up*/
3265 if (tet_initialise_setup(false)) {
3266 printf("\nSetup Initialisation has Failed \n");
3267 FAIL = 1;
3268 } else {
3269 printf(
3270 "\nTest Case 7: Send a message to unsubscribed Svc INTMIN on Active Vdest:Implicit/Explicit Combination\n");
3271 /*--------------------------------------------------------------------*/
3274 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
3275 printf("\nFail\n");
3276 FAIL = 1;
3277 }
3281 printf("\nFail\n");
3282 FAIL = 1;
3283 }
3284
3285 if (mds_just_send(
3289 printf("\nFail\n");
3290 FAIL = 1;
3291 }
3292
3296 printf("\nFail\n");
3297 FAIL = 1;
3298 }
3302 printf("\nFail\n");
3303 FAIL = 1;
3304 } else
3305 printf("\nSuccess\n");
3306
3307 if (mds_just_send(
3311 printf("\nFail\n");
3312 FAIL = 1;
3313 }
3314
3315 printf("\tCancelling the subscription svc_ids");
3318 1, svc_ids) != NCSCC_RC_SUCCESS) {
3319 printf("\nFail\n");
3320 FAIL = 1;
3321 }
3322
3323 printf("\tCancelling the subscription svcids");
3326 1, svcids) != NCSCC_RC_SUCCESS) {
3327 printf("Fail");
3328 FAIL = 1;
3329 }
3330 }
3331
3332 /*clean up*/
3333 if (tet_cleanup_setup()) {
3334 printf("\nSetup Clean Up has Failed \n");
3335 FAIL = 1;
3336 }
3337
3338 free(mesg);
3339 test_validate(FAIL, 0);
3340}
3341
3343{
3344 int FAIL = 0;
3346 gl_vdest_indx = 0;
3347
3348 char tmp[] = " Hi Receiver ";
3349 TET_MDS_MSG *mesg;
3350 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
3351 memset(mesg, 0, sizeof(TET_MDS_MSG));
3352 memcpy(mesg->send_data, tmp, sizeof(tmp));
3353 mesg->send_len = sizeof(tmp);
3354
3355 /*start up*/
3356 if (tet_initialise_setup(false)) {
3357 printf("\nSetup Initialisation has Failed \n");
3358 FAIL = 1;
3359 } else {
3360 printf(
3361 "\nTest Case 8: Not able to send a message to Svc EXTMIN with Improper Priority\n");
3362 /*--------------------------------------------------------------------*/
3363 printf("\nSubscribe\n");
3366 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
3367 printf("\nFail\n");
3368 FAIL = 1;
3369 }
3373 printf("\nFail\n");
3374 FAIL = 1;
3375 }
3376
3377 if (mds_just_send(
3380 mesg) == NCSCC_RC_SUCCESS) {
3381 printf("\nFail\n");
3382 FAIL = 1;
3383 }
3384
3385 printf("\nCancelling the subscription\n");
3388 1, svcids) != NCSCC_RC_SUCCESS) {
3389 printf("\nFail\n");
3390 FAIL = 1;
3391 }
3392 }
3393
3394 /*clean up*/
3395 if (tet_cleanup_setup()) {
3396 printf("\nSetup Clean Up has Failed \n");
3397 FAIL = 1;
3398 }
3399
3400 free(mesg);
3401 test_validate(FAIL, 0);
3402}
3403
3405{
3406 int FAIL = 0;
3408 gl_vdest_indx = 0;
3409
3410 char tmp[] = " Hi Receiver ";
3411 TET_MDS_MSG *mesg;
3412 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
3413 memset(mesg, 0, sizeof(TET_MDS_MSG));
3414 memcpy(mesg->send_data, tmp, sizeof(tmp));
3415 mesg->send_len = sizeof(tmp);
3416
3417 /*start up*/
3418 if (tet_initialise_setup(false)) {
3419 printf("\nSetup Initialisation has Failed \n");
3420 FAIL = 1;
3421 } else {
3422 printf(
3423 "\nTest Case 9: Not able to send aNULL message to Svc EXTMIN on Active Vdest\n");
3424 /*--------------------------------------------------------------------*/
3425 printf("\nSubscribe\n");
3428 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
3429 printf("\nFail\n");
3430 FAIL = 1;
3431 }
3435 printf("\nFail\n");
3436 FAIL = 1;
3437 }
3438
3439 if (mds_just_send(
3443 printf("\nFail\n");
3444 FAIL = 1;
3445 }
3446
3447 printf("\nCancelling the subscription\n");
3450 1, svcids) != NCSCC_RC_SUCCESS) {
3451 printf("\nFail\n");
3452 FAIL = 1;
3453 }
3454 }
3455
3456 /*clean up*/
3457 if (tet_cleanup_setup()) {
3458 printf("\nSetup Clean Up has Failed \n");
3459 FAIL = 1;
3460 }
3461
3462 free(mesg);
3463 test_validate(FAIL, 0);
3464}
3465
3467{
3468 int FAIL = 0;
3470 gl_vdest_indx = 0;
3471
3472 char tmp[] = " Hi Receiver ";
3473 TET_MDS_MSG *mesg;
3474 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
3475 memset(mesg, 0, sizeof(TET_MDS_MSG));
3476 memcpy(mesg->send_data, tmp, sizeof(tmp));
3477 mesg->send_len = sizeof(tmp);
3478
3479 /*start up*/
3480 if (tet_initialise_setup(false)) {
3481 printf("\nSetup Initialisation has Failed \n");
3482 FAIL = 1;
3483 } else {
3484 printf(
3485 "\nTest Case 10: Now send a message( > MDS_DIRECT_BUF_MAXSIZE) to Svc EXTMIN\n");
3486 /*--------------------------------------------------------------------*/
3487 printf("\nSubscribe\n");
3490 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
3491 printf("\nFail\n");
3492 FAIL = 1;
3493 }
3497 printf("\nFail\n");
3498 FAIL = 1;
3499 }
3500
3501 memset(mesg->send_data, 'S', 2 * MSG_SIZE + 2);
3502 mesg->send_len = 2 * MSG_SIZE + 2;
3503 if (mds_just_send(
3507 printf("\nFail\n");
3508 FAIL = 1;
3509 }
3510
3511 printf("\nCancelling the subscription\n");
3514 1, svcids) != NCSCC_RC_SUCCESS) {
3515 printf("\nFail\n");
3516 FAIL = 1;
3517 }
3518 }
3519
3520 /*clean up*/
3521 if (tet_cleanup_setup()) {
3522 printf("\nSetup Clean Up has Failed \n");
3523 FAIL = 1;
3524 }
3525
3526 free(mesg);
3527 test_validate(FAIL, 0);
3528}
3529
3531{
3532 int FAIL = 0;
3534 gl_vdest_indx = 0;
3535
3536 NCSMDS_INFO svc_to_mds_info;
3537 char tmp[] = " Hi Receiver ";
3538 TET_MDS_MSG *mesg;
3539 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
3540 memset(mesg, 0, sizeof(TET_MDS_MSG));
3541 memcpy(mesg->send_data, tmp, sizeof(tmp));
3542 mesg->send_len = sizeof(tmp);
3543
3544 /*start up*/
3545 if (tet_initialise_setup(false)) {
3546 printf("\nSetup Initialisation has Failed \n");
3547 FAIL = 1;
3548 } else {
3549 printf(
3550 "\nTest Case 11: Not able to Send a message with Invalid Send type\n");
3551 /*--------------------------------------------------------------------*/
3552 printf("\nSubscribe\n");
3555 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
3556 printf("\nFail\n");
3557 FAIL = 1;
3558 }
3562 printf("\nFail\n");
3563 FAIL = 1;
3564 }
3565
3566 svc_to_mds_info.i_mds_hdl = gl_tet_adest.mds_pwe1_hdl;
3567 svc_to_mds_info.i_svc_id = NCSMDS_SVC_ID_EXTERNAL_MIN;
3568 svc_to_mds_info.i_op = MDS_SEND;
3569 svc_to_mds_info.info.svc_send.i_msg = mesg;
3570 svc_to_mds_info.info.svc_send.i_to_svc =
3572 svc_to_mds_info.info.svc_send.i_priority =
3574 svc_to_mds_info.info.svc_send.i_sendtype =
3575 12; /*wrong send type*/
3576 svc_to_mds_info.info.svc_send.info.snd.i_to_dest =
3578 if (ncsmds_api(&svc_to_mds_info) == NCSCC_RC_SUCCESS) {
3579 printf("\nFail\n");
3580 FAIL = 1;
3581 }
3582
3583 printf("\nCancelling the subscription\n");
3586 1, svcids) != NCSCC_RC_SUCCESS) {
3587 printf("\nFail\n");
3588 FAIL = 1;
3589 }
3590 }
3591
3592 /*clean up*/
3593 if (tet_cleanup_setup()) {
3594 printf("\nSetup Clean Up has Failed \n");
3595 FAIL = 1;
3596 }
3597
3598 free(mesg);
3599 test_validate(FAIL, 0);
3600}
3601
3603{
3604 int FAIL = 0;
3606 gl_vdest_indx = 0;
3607
3608 char tmp[] = " Hi Receiver ";
3609 TET_MDS_MSG *mesg;
3610 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
3611 memset(mesg, 0, sizeof(TET_MDS_MSG));
3612 memcpy(mesg->send_data, tmp, sizeof(tmp));
3613 mesg->send_len = sizeof(tmp);
3614
3615 /*start up*/
3616 if (tet_initialise_setup(false)) {
3617 printf("\nSetup Initialisation has Failed \n");
3618 FAIL = 1;
3619 } else {
3620 printf(
3621 "\nTest Case 12: While Await Active timer is On: send a message to Svc EXTMIN Vdest=200\n");
3622 /*--------------------------------------------------------------------*/
3623 printf("\nSubscribe\n");
3626 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
3627 printf("\nFail\n");
3628 FAIL = 1;
3629 }
3633 printf("\nFail\n");
3634 FAIL = 1;
3635 }
3636
3637 sleep(1);
3640 printf("\nFail\n");
3641 FAIL = 1;
3642 }
3643 sleep(2);
3644 if (mds_just_send(
3648 printf("\nFail\n");
3649 FAIL = 1;
3650 } else
3651 printf("\nSuccess\n");
3652
3655 printf("\nFail\n");
3656 FAIL = 1;
3657 }
3658
3659 printf("\nCancelling the subscription\n");
3662 1, svcids) != NCSCC_RC_SUCCESS) {
3663 printf("\nFail\n");
3664 FAIL = 1;
3665 }
3666 }
3667
3668 /*clean up*/
3669 if (tet_cleanup_setup()) {
3670 printf("\nSetup Clean Up has Failed \n");
3671 FAIL = 1;
3672 }
3673
3674 free(mesg);
3675 test_validate(FAIL, 0);
3676}
3677
3679{
3680 int FAIL = 0;
3682 gl_vdest_indx = 0;
3683
3684 char tmp[] = " Hi Receiver ";
3685 TET_MDS_MSG *mesg;
3686 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
3687 memset(mesg, 0, sizeof(TET_MDS_MSG));
3688 memcpy(mesg->send_data, tmp, sizeof(tmp));
3689 mesg->send_len = sizeof(tmp);
3690
3691 /*start up*/
3692 if (tet_initialise_setup(false)) {
3693 printf("\nSetup Initialisation has Failed \n");
3694 FAIL = 1;
3695 } else {
3696 printf(
3697 "\nTest Case 13: Send a message to Svc EXTMIN on QUIESCED Vdest=200\n");
3698 /*--------------------------------------------------------------------*/
3699 printf("\nSubscribe\n");
3702 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
3703 printf("\nFail\n");
3704 FAIL = 1;
3705 }
3709 printf("\nFail\n");
3710 FAIL = 1;
3711 }
3712
3713 sleep(1);
3716 printf("\nFail\n");
3717 FAIL = 1;
3718 }
3719 sleep(2);
3720 if (mds_just_send(
3724 printf("\nFail\n");
3725 FAIL = 1;
3726 } else
3727 printf("\nSuccess\n");
3730 printf("\nFail\n");
3731 FAIL = 1;
3732 }
3733
3734 printf("\nCancelling the subscription\n");
3737 1, svcids) != NCSCC_RC_SUCCESS) {
3738 printf("\nFail\n");
3739 FAIL = 1;
3740 }
3741 }
3742 /*clean up*/
3743 if (tet_cleanup_setup()) {
3744 printf("\nSetup Clean Up has Failed \n");
3745 FAIL = 1;
3746 }
3747
3748 free(mesg);
3749 test_validate(FAIL, 0);
3750}
3751
3753{
3754 int FAIL = 0;
3756 gl_vdest_indx = 0;
3757
3758 char tmp[] = " Hi Receiver ";
3759 TET_MDS_MSG *mesg;
3760 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
3761 memset(mesg, 0, sizeof(TET_MDS_MSG));
3762 memcpy(mesg->send_data, tmp, sizeof(tmp));
3763 mesg->send_len = sizeof(tmp);
3764
3765 /*start up*/
3766 if (tet_initialise_setup(false)) {
3767 printf("\nSetup Initialisation has Failed \n");
3768 FAIL = 1;
3769 } else {
3770 printf(
3771 "Test Case 14: Copy Callback returning Failure: Send Fails\n");
3772 /*--------------------------------------------------------------------*/
3775 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
3776 printf("\nFail\n");
3777 FAIL = 1;
3778 }
3782 printf("\nFail\n");
3783 FAIL = 1;
3784 }
3785
3786 /*Returning Failure at Copy CallBack*/
3787 gl_COPY_CB_FAIL = 1;
3788 if (mds_just_send(
3792 printf("\nFail\n");
3793 FAIL = 1;
3794 } else
3795 printf("\nSuccess\n");
3796
3797 /*Resetting it*/
3798 gl_COPY_CB_FAIL = 0;
3799
3800 printf("\tCancelling the subscription\n");
3803 1, svcids) != NCSCC_RC_SUCCESS) {
3804 printf("\nFail\n");
3805 FAIL = 1;
3806 }
3807 }
3808
3809 /*clean up*/
3810 if (tet_cleanup_setup()) {
3811 printf("\nSetup Clean Up has Failed \n");
3812 FAIL = 1;
3813 }
3814
3815 free(mesg);
3816 test_validate(FAIL, 0);
3817}
3818
3820{
3821 int FAIL = 0;
3823
3824 if (tet_initialise_setup(false)) {
3825 printf("\nSetup Initialisation has Failed \n");
3826 FAIL = 1;
3827 } else {
3828 /*--------SEND
3829 * ACKNOWLEDGE-------------------------------------------*/
3832 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
3833 printf("\nFail\n");
3834 FAIL = 1;
3835 }
3839 printf("\nFail\n");
3840 FAIL = 1;
3841 }
3842 }
3843 if (FAIL != 0) {
3844 return false;
3845 }
3846 return true;
3847}
3848
3850{
3851 int FAIL = 0;
3852 // int id;
3854 // MDS_SVC_ID svc_ids[]={NCSMDS_SVC_ID_INTERNAL_MIN};
3855
3856 if (setup_send_ack_tp() == true) {
3857 char tmp[] = " Hi Receiver! Are you there? ";
3858 TET_MDS_MSG *mesg;
3859 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
3860 memset(mesg, 0, sizeof(TET_MDS_MSG));
3861 memcpy(mesg->send_data, tmp, sizeof(tmp));
3862 mesg->send_len = sizeof(tmp);
3863
3864 printf(
3865 "\nTest Case 1: Now send LOW,MEDIUM,HIGH and VERY HIGH Priority messages with ACK to Svc on ACtive VDEST in sequence\n");
3866 if (mds_send_get_ack(
3870 printf("\nFail\n");
3871 FAIL = 1;
3872 } else
3873 printf("LOW Success\n");
3874
3875 if (mds_send_get_ack(
3879 printf("\nFail\n");
3880 FAIL = 1;
3881 } else
3882 printf("MEDIUM Success\n");
3883
3884 if (mds_send_get_ack(
3888 printf("\nFail\n");
3889 FAIL = 1;
3890 } else
3891 printf("HIGH Success\n");
3892
3893 if (mds_send_get_ack(
3897 mesg) != NCSCC_RC_SUCCESS) {
3898 printf("\nFail\n");
3899 FAIL = 1;
3900 } else
3901 printf("VERY HIGH Success\n");
3902
3903 free(mesg);
3904 } else {
3905 FAIL = 1;
3906 }
3907 /*------------------------------------------------------------------*/
3908 /*clean up*/
3909 printf("\nCancelling the subscription\n");
3912 svcids) != NCSCC_RC_SUCCESS) {
3913 printf("Cancelling the subscription Failed\n");
3914 FAIL = 1;
3915 }
3916 /*--------------------------------------------------------------------*/
3917 /*clean up*/
3918 if (tet_cleanup_setup()) {
3919 printf("\nSetup Clean Up has Failed \n");
3920 FAIL = 1;
3921 }
3922
3923 test_validate(FAIL, 0);
3924}
3925
3927{
3928 int FAIL = 0;
3930
3931 if (setup_send_ack_tp() == true) {
3932 char tmp[] = " Hi Receiver! Are you there? ";
3933 TET_MDS_MSG *mesg;
3934 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
3935 memset(mesg, 0, sizeof(TET_MDS_MSG));
3936 memcpy(mesg->send_data, tmp, sizeof(tmp));
3937 mesg->send_len = sizeof(tmp);
3938
3939 printf(
3940 "\nTest Case 2: Not able to send a message with ACK to 1700 with Invalid pwe handle\n");
3941 if (mds_send_get_ack(
3945 mesg) == NCSCC_RC_SUCCESS) {
3946 printf("\nFail\n");
3947 FAIL = 1;
3948 } else
3949 printf("\nSuccess\n");
3950
3951 free(mesg);
3952 } else {
3953 FAIL = 1;
3954 }
3955 /*------------------------------------------------------------------*/
3956 /*clean up*/
3957 printf("\nCancelling the subscription\n");
3960 svcids) != NCSCC_RC_SUCCESS) {
3961 printf("Cancelling the subscription Failed\n");
3962 FAIL = 1;
3963 }
3964 /*--------------------------------------------------------------------*/
3965 /*clean up*/
3966 if (tet_cleanup_setup()) {
3967 printf("\nSetup Clean Up has Failed \n");
3968 FAIL = 1;
3969 }
3970
3971 test_validate(FAIL, 0);
3972}
3973
3975{
3976 int FAIL = 0;
3978
3979 if (setup_send_ack_tp() == true) {
3980 char tmp[] = " Hi Receiver! Are you there? ";
3981 TET_MDS_MSG *mesg;
3982 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
3983 memset(mesg, 0, sizeof(TET_MDS_MSG));
3984 memcpy(mesg->send_data, tmp, sizeof(tmp));
3985 mesg->send_len = sizeof(tmp);
3986
3987 printf(
3988 "\nTest Case 3: Not able to send a message with ACK to 1700 with NULL pwe handle\n");
3989 if (mds_send_get_ack(
3993 printf("\nFail\n");
3994 FAIL = 1;
3995 } else
3996 printf("\nSuccess\n");
3997
3998 free(mesg);
3999 } else {
4000 FAIL = 1;
4001 }
4002 /*------------------------------------------------------------------*/
4003 /*clean up*/
4004 printf("\nCancelling the subscription\n");
4007 svcids) != NCSCC_RC_SUCCESS) {
4008 printf("Cancelling the subscription Failed\n");
4009 FAIL = 1;
4010 }
4011 /*--------------------------------------------------------------------*/
4012 /*clean up*/
4013 if (tet_cleanup_setup()) {
4014 printf("\nSetup Clean Up has Failed \n");
4015 FAIL = 1;
4016 }
4017
4018 test_validate(FAIL, 0);
4019}
4020
4022{
4023 int FAIL = 0;
4025
4026 if (setup_send_ack_tp() == true) {
4027 char tmp[] = " Hi Receiver! Are you there? ";
4028 TET_MDS_MSG *mesg;
4029 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
4030 memset(mesg, 0, sizeof(TET_MDS_MSG));
4031 memcpy(mesg->send_data, tmp, sizeof(tmp));
4032 mesg->send_len = sizeof(tmp);
4033
4034 printf(
4035 "\nTest Case 4: Not able to send a message with ACK to 1700 with Wrong DEST\n");
4036 if (mds_send_get_ack(
4040 printf("\nFail\n");
4041 FAIL = 1;
4042 } else
4043 printf("\nSuccess\n");
4044
4045 free(mesg);
4046 } else {
4047 FAIL = 1;
4048 }
4049 /*------------------------------------------------------------------*/
4050 /*clean up*/
4051 printf("\nCancelling the subscription\n");
4054 svcids) != NCSCC_RC_SUCCESS) {
4055 printf("Cancelling the subscription Failed\n");
4056 FAIL = 1;
4057 }
4058 /*--------------------------------------------------------------------*/
4059 /*clean up*/
4060 if (tet_cleanup_setup()) {
4061 printf("\nSetup Clean Up has Failed \n");
4062 FAIL = 1;
4063 }
4064
4065 test_validate(FAIL, 0);
4066}
4067
4069{
4070 int FAIL = 0;
4072
4073 if (setup_send_ack_tp() == true) {
4074 char tmp[] = " Hi Receiver! Are you there? ";
4075 TET_MDS_MSG *mesg;
4076 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
4077 memset(mesg, 0, sizeof(TET_MDS_MSG));
4078 memcpy(mesg->send_data, tmp, sizeof(tmp));
4079 mesg->send_len = sizeof(tmp);
4080
4081 printf(
4082 "\nTest Case 5: Not able to send a message with ACK to service which is Not installed\n");
4083 if (mds_send_get_ack(
4086 mesg) == NCSCC_RC_SUCCESS) {
4087 printf("\nFail\n");
4088 FAIL = 1;
4089 } else
4090 printf("\nSuccess\n");
4091
4092 free(mesg);
4093 } else {
4094 FAIL = 1;
4095 }
4096 /*------------------------------------------------------------------*/
4097 /*clean up*/
4098 printf("\nCancelling the subscription\n");
4101 svcids) != NCSCC_RC_SUCCESS) {
4102 printf("Cancelling the subscription Failed\n");
4103 FAIL = 1;
4104 }
4105 /*--------------------------------------------------------------------*/
4106 /*clean up*/
4107 if (tet_cleanup_setup()) {
4108 printf("\nSetup Clean Up has Failed \n");
4109 FAIL = 1;
4110 }
4111
4112 test_validate(FAIL, 0);
4113}
4114
4116{
4117 int FAIL = 0;
4119
4120 if (setup_send_ack_tp() == true) {
4121 char tmp[] = " Hi Receiver! Are you there? ";
4122 TET_MDS_MSG *mesg;
4123 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
4124 memset(mesg, 0, sizeof(TET_MDS_MSG));
4125 memcpy(mesg->send_data, tmp, sizeof(tmp));
4126 mesg->send_len = sizeof(tmp);
4127
4128 printf(
4129 "\nTest Case 6: Not able to send a message with ACK to OAC service on this DEST\n");
4130 if (mds_send_get_ack(
4133 mesg) == NCSCC_RC_SUCCESS) {
4134 printf("\nFail\n");
4135 FAIL = 1;
4136 } else
4137 printf("\nSuccess\n");
4138
4139 free(mesg);
4140 } else {
4141 FAIL = 1;
4142 }
4143 /*------------------------------------------------------------------*/
4144 /*clean up*/
4145 printf("\nCancelling the subscription\n");
4148 svcids) != NCSCC_RC_SUCCESS) {
4149 printf("Cancelling the subscription Failed\n");
4150 FAIL = 1;
4151 }
4152 /*--------------------------------------------------------------------*/
4153 /*clean up*/
4154 if (tet_cleanup_setup()) {
4155 printf("\nSetup Clean Up has Failed \n");
4156 FAIL = 1;
4157 }
4158
4159 test_validate(FAIL, 0);
4160}
4161
4163{
4164 int FAIL = 0;
4165 int id;
4167
4168 if (setup_send_ack_tp() == true) {
4169 char tmp[] = " Hi Receiver! Are you there? ";
4170 TET_MDS_MSG *mesg;
4171 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
4172 memset(mesg, 0, sizeof(TET_MDS_MSG));
4173 memcpy(mesg->send_data, tmp, sizeof(tmp));
4174 mesg->send_len = sizeof(tmp);
4175
4176 printf(
4177 "\nTest Case 7: Able to send a message with ACK 1000 times to service 1700\n");
4178 for (id = 1; id <= 1000; id++)
4182 gl_tet_vdest[1].vdest, 100,
4184 mesg) != NCSCC_RC_SUCCESS) {
4185 printf("\nFail\n");
4186 FAIL = 1;
4187 break;
4188 }
4189 if (id == 1001) {
4190 printf("\n\n\t ALL THE MESSAGES GOT DELIVERED\n\n");
4191 sleep(1);
4192 printf("\nSuccess\n");
4193 }
4194
4195 free(mesg);
4196 } else {
4197 FAIL = 1;
4198 }
4199 /*------------------------------------------------------------------*/
4200 /*clean up*/
4201 printf("\nCancelling the subscription\n");
4204 svcids) != NCSCC_RC_SUCCESS) {
4205 printf("Cancelling the subscription Failed\n");
4206 FAIL = 1;
4207 }
4208 /*--------------------------------------------------------------------*/
4209 /*clean up*/
4210 if (tet_cleanup_setup()) {
4211 printf("\nSetup Clean Up has Failed \n");
4212 FAIL = 1;
4213 }
4214
4215 test_validate(FAIL, 0);
4216}
4217
4219{
4220 int FAIL = 0;
4221 // int id;
4224
4225 if (setup_send_ack_tp() == true) {
4226 char tmp[] = " Hi Receiver! Are you there? ";
4227 TET_MDS_MSG *mesg;
4228 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
4229 memset(mesg, 0, sizeof(TET_MDS_MSG));
4230 memcpy(mesg->send_data, tmp, sizeof(tmp));
4231 mesg->send_len = sizeof(tmp);
4232
4233 printf(
4234 "\nTest Case 8: Send a message with ACK to unsubscribed service 1600\n");
4235 if (mds_send_get_ack(
4239 printf("\nFail\n");
4240 FAIL = 1;
4241 } else
4242 printf("\nSuccess\n");
4246 printf("\nFail\n");
4247 FAIL = 1;
4248 }
4252 printf("\nFail\n");
4253 FAIL = 1;
4254 }
4255 if (mds_send_get_ack(
4259 printf("\nFail\n");
4260 FAIL = 1;
4261 } else
4262 printf("\nSuccess\n");
4263
4266 1, svc_ids) != NCSCC_RC_SUCCESS) {
4267 printf("\nFail\n");
4268 FAIL = 1;
4269 }
4270
4271 free(mesg);
4272 } else {
4273 FAIL = 1;
4274 }
4275 /*------------------------------------------------------------------*/
4276 /*clean up*/
4277 printf("\nCancelling the subscription\n");
4280 svcids) != NCSCC_RC_SUCCESS) {
4281 printf("Cancelling the subscription Failed\n");
4282 FAIL = 1;
4283 }
4284 /*--------------------------------------------------------------------*/
4285 /*clean up*/
4286 if (tet_cleanup_setup()) {
4287 printf("\nSetup Clean Up has Failed \n");
4288 FAIL = 1;
4289 }
4290
4291 test_validate(FAIL, 0);
4292}
4293
4295{
4296 int FAIL = 0;
4298
4299 if (setup_send_ack_tp() == true) {
4300 char tmp[] = " Hi Receiver! Are you there? ";
4301 TET_MDS_MSG *mesg;
4302 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
4303 memset(mesg, 0, sizeof(TET_MDS_MSG));
4304 memcpy(mesg->send_data, tmp, sizeof(tmp));
4305 mesg->send_len = sizeof(tmp);
4306 printf(
4307 "\nTest Case 9: Not able to send_ack a message with Improper Priority to 1700\n");
4308 if (mds_send_get_ack(
4311 0, mesg) == NCSCC_RC_SUCCESS) {
4312 printf("\nFail\n");
4313 FAIL = 1;
4314 } else
4315 printf("\nSuccess\n");
4316
4317 free(mesg);
4318 } else {
4319 FAIL = 1;
4320 }
4321 /*------------------------------------------------------------------*/
4322 /*clean up*/
4323 printf("\nCancelling the subscription\n");
4326 svcids) != NCSCC_RC_SUCCESS) {
4327 printf("Cancelling the subscription Failed\n");
4328 FAIL = 1;
4329 }
4330 /*--------------------------------------------------------------------*/
4331 /*clean up*/
4332 if (tet_cleanup_setup()) {
4333 printf("\nSetup Clean Up has Failed \n");
4334 FAIL = 1;
4335 }
4336
4337 test_validate(FAIL, 0);
4338}
4339
4341{
4342 int FAIL = 0;
4344
4345 if (setup_send_ack_tp() == true) {
4346 char tmp[] = " Hi Receiver! Are you there? ";
4347 TET_MDS_MSG *mesg;
4348 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
4349 memset(mesg, 0, sizeof(TET_MDS_MSG));
4350 memcpy(mesg->send_data, tmp, sizeof(tmp));
4351 mesg->send_len = sizeof(tmp);
4352 printf(
4353 "\nTest Case 10: Not able to send a NULL message with ACK to 1700\n");
4354 if (mds_send_get_ack(
4358 printf("\nFail\n");
4359 FAIL = 1;
4360 } else
4361 printf("\nSuccess\n");
4362
4363 free(mesg);
4364 } else {
4365 FAIL = 1;
4366 }
4367 /*------------------------------------------------------------------*/
4368 /*clean up*/
4369 printf("\nCancelling the subscription\n");
4372 svcids) != NCSCC_RC_SUCCESS) {
4373 printf("Cancelling the subscription Failed\n");
4374 FAIL = 1;
4375 }
4376 /*--------------------------------------------------------------------*/
4377 /*clean up*/
4378 if (tet_cleanup_setup()) {
4379 printf("\nSetup Clean Up has Failed \n");
4380 FAIL = 1;
4381 }
4382
4383 test_validate(FAIL, 0);
4384}
4385
4387{
4388 int FAIL = 0;
4390
4391 if (setup_send_ack_tp() == true) {
4392 char tmp[] = " Hi Receiver! Are you there? ";
4393 TET_MDS_MSG *mesg;
4394 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
4395 memset(mesg, 0, sizeof(TET_MDS_MSG));
4396 memcpy(mesg->send_data, tmp, sizeof(tmp));
4397 mesg->send_len = sizeof(tmp);
4398 printf(
4399 "Test Case 11: Now send a message( > MDS_DIRECT_BUF_MAXSIZE) to 1700\n");
4400 memset(mesg->send_data, 'S', 2 * MSG_SIZE + 2);
4401 mesg->send_len = 2 * MSG_SIZE + 2;
4402 if (mds_send_get_ack(
4406 printf("\nFail\n");
4407 FAIL = 1;
4408 } else
4409 printf("\nSuccess\n");
4410
4411 free(mesg);
4412 } else {
4413 FAIL = 1;
4414 }
4415 /*------------------------------------------------------------------*/
4416 /*clean up*/
4417 printf("\nCancelling the subscription\n");
4420 svcids) != NCSCC_RC_SUCCESS) {
4421 printf("Cancelling the subscription Failed\n");
4422 FAIL = 1;
4423 }
4424 /*--------------------------------------------------------------------*/
4425 /*clean up*/
4426 if (tet_cleanup_setup()) {
4427 printf("\nSetup Clean Up has Failed \n");
4428 FAIL = 1;
4429 }
4430
4431 test_validate(FAIL, 0);
4432}
4433
4435{
4436 int FAIL = 0;
4438
4439 if (setup_send_ack_tp() == true) {
4440 char tmp[] = " Hi Receiver! Are you there? ";
4441 TET_MDS_MSG *mesg;
4442 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
4443 memset(mesg, 0, sizeof(TET_MDS_MSG));
4444 memcpy(mesg->send_data, tmp, sizeof(tmp));
4445 mesg->send_len = sizeof(tmp);
4446 printf(
4447 "Test Case 12: While Await Active timer is On: send_ack a message to Svc EXTMIN Vdest=200\n");
4448 sleep(1);
4451 printf("\nFail\n");
4452 FAIL = 1;
4453 }
4454 sleep(2);
4455 if (mds_send_get_ack(
4459 printf("\nFail\n");
4460 FAIL = 1;
4461 } else
4462 printf("\nSuccess\n");
4465 printf("\nFail\n");
4466 FAIL = 1;
4467 } else
4468 printf("\nSuccess\n");
4469
4470 free(mesg);
4471 } else {
4472 FAIL = 1;
4473 }
4474 /*------------------------------------------------------------------*/
4475 /*clean up*/
4476 printf("\nCancelling the subscription\n");
4479 svcids) != NCSCC_RC_SUCCESS) {
4480 printf("Cancelling the subscription Failed\n");
4481 FAIL = 1;
4482 }
4483 /*--------------------------------------------------------------------*/
4484 /*clean up*/
4485 if (tet_cleanup_setup()) {
4486 printf("\nSetup Clean Up has Failed \n");
4487 FAIL = 1;
4488 }
4489
4490 test_validate(FAIL, 0);
4491}
4492
4494{
4495 int FAIL = 0;
4497
4498 if (setup_send_ack_tp() == true) {
4499 char tmp[] = " Hi Receiver! Are you there? ";
4500 TET_MDS_MSG *mesg;
4501 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
4502 memset(mesg, 0, sizeof(TET_MDS_MSG));
4503 memcpy(mesg->send_data, tmp, sizeof(tmp));
4504 mesg->send_len = sizeof(tmp);
4505 printf(
4506 "Test Case 13: Send_ack a message to Svc EXTMIN on QUIESCED Vdest=200\n");
4507 sleep(1);
4510 printf("\nFail\n");
4511 FAIL = 1;
4512 }
4513 sleep(2);
4514 if (mds_send_get_ack(
4518 printf("\nFail\n");
4519 FAIL = 1;
4520 } else
4521 printf("\nSuccess\n");
4524 printf("\nFail\n");
4525 FAIL = 1;
4526 }
4527
4528 free(mesg);
4529 } else {
4530 FAIL = 1;
4531 }
4532 /*------------------------------------------------------------------*/
4533 /*clean up*/
4534 printf("\nCancelling the subscription\n");
4537 svcids) != NCSCC_RC_SUCCESS) {
4538 printf("Cancelling the subscription Failed\n");
4539 FAIL = 1;
4540 }
4541 /*--------------------------------------------------------------------*/
4542 /*clean up*/
4543 if (tet_cleanup_setup()) {
4544 printf("\nSetup Clean Up has Failed \n");
4545 FAIL = 1;
4546 }
4547
4548 test_validate(FAIL, 0);
4549}
4550
4552{
4553 int FAIL = 0;
4555 /*Start up*/
4556 if (tet_initialise_setup(false)) {
4557 printf("\nSetup Initialisation has Failed \n");
4558 FAIL = 1;
4559 } else {
4560 printf(
4561 "\nTest case 1: Get the details of all the Services on this core\n");
4565 printf("\nFail\n");
4566 FAIL = 1;
4567 }
4571 printf("\nFail\n");
4572 FAIL = 1;
4573 }
4574 if (mds_service_query_for_pwe(gl_tet_vdest[0].mds_pwe1_hdl,
4577 printf("\nFail\n");
4578 FAIL = 1;
4579 }
4580 if (mds_service_query_for_pwe(gl_tet_vdest[1].mds_pwe1_hdl,
4583 printf("\nFail\n");
4584 FAIL = 1;
4585 }
4586 if (mds_service_query_for_pwe(gl_tet_vdest[1].mds_pwe1_hdl,
4589 printf("\nFail\n");
4590 FAIL = 1;
4591 }
4592
4595 NCSMDS_SCOPE_NONE, 1, svcids) != NCSCC_RC_SUCCESS) {
4596 printf("\nFail mds_service_redundant_subscribe\n");
4597 FAIL = 1;
4598 }
4599
4603 printf("\nFail mds_service_retrieve\n");
4604 FAIL = 1;
4605 }
4606
4607 /*mds_query_vdest_for_anchor(gl_tet_adest.mds_pwe1_hdl,2000,100,
4608 2000,0);*/
4609
4612 1, svcids) != NCSCC_RC_SUCCESS) {
4613 printf("\nmds_service_cancel_subscription\n");
4614 FAIL = 1;
4615 }
4616
4617 /*clean up*/
4618 if (tet_cleanup_setup()) {
4619 FAIL = 1;
4620 }
4621 }
4622
4623 test_validate(FAIL, 0);
4624}
4625
4627{
4628 int FAIL = 0;
4629 /*Start up*/
4630 if (tet_initialise_setup(false)) {
4631 printf("\nSetup Initialisation has Failed \n");
4632 FAIL = 1;
4633 } else {
4634 printf(
4635 "\nTest Case 2: It shall not be able to query PWE with Invalid PWE Handle\n");
4636 if (mds_service_query_for_pwe((MDS_HDL)(long)NULL,
4639 printf("\nFail\n");
4640 FAIL = 1;
4641 }
4644 printf("\nFail\n");
4645 FAIL = 1;
4646 }
4647 if (mds_service_query_for_pwe(gl_tet_vdest[0].mds_vdest_hdl,
4650 printf("\nFail\n");
4651 FAIL = 1;
4652 }
4653 /*clean up*/
4654 if (tet_cleanup_setup()) {
4655 FAIL = 1;
4656 }
4657 }
4658
4659 test_validate(FAIL, 0);
4660}
4661
4663{
4664 int FAIL = 0;
4665 /*Start up*/
4666 if (tet_initialise_setup(false)) {
4667 printf("\nSetup Initialisation has Failed \n");
4668 FAIL = 1;
4669 } else {
4670 printf("\nTest Case 3: ?????mds_query_vdest_for_anchor\n");
4674 0) == NCSCC_RC_SUCCESS) {
4675 printf("\nFail\n");
4676 FAIL = 1;
4677 }
4678 }
4679
4680 /*clean up*/
4681 if (tet_cleanup_setup()) {
4682 FAIL = 1;
4683 }
4684
4685 test_validate(FAIL, 0);
4686}
4687
4689{
4690 MDS_SVC_ID svc_id;
4691 bool rsp_reqd = false;
4692 char tmp[] = " Hi Sender! My Name is RECEIVER ";
4693 TET_MDS_MSG *mesg;
4694 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
4695 memset(mesg, 0, sizeof(TET_MDS_MSG));
4696 memcpy(mesg->send_data, tmp, sizeof(tmp));
4697 mesg->send_len = sizeof(tmp);
4698
4699 printf("\nInside Receiver Thread\n");
4700 fflush(stdout);
4701 if ((svc_id = is_adest_sel_obj_found(3))) {
4702 printf("\n\t Got the message: trying to retreive it\n");
4703 fflush(stdout);
4707 printf("Fail mds_service_retrieve\n");
4708 }
4709
4710 /*after that send a response to the sender, if it expects*/
4711 pthread_mutex_lock(&gl_mutex);
4712 rsp_reqd = gl_rcvdmsginfo.rsp_reqd;
4713 pthread_mutex_unlock(&gl_mutex);
4714 if (rsp_reqd) {
4717 mesg) != NCSCC_RC_SUCCESS) {
4718 printf("Response Fail\n");
4719 } else
4720 printf("Response Success\n");
4721 pthread_mutex_lock(&gl_mutex);
4723 pthread_mutex_unlock(&gl_mutex);
4724 }
4725 }
4726
4727 free(mesg);
4728}
4729
4731{
4732 MDS_SVC_ID svc_id;
4733 bool rsp_reqd = false;
4734 char tmp[] = " Hi Sender! My Name is RECEIVER ";
4735 TET_MDS_MSG *mesg;
4736 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
4737 pthread_cleanup_push(free, mesg);
4738 memset(mesg, 0, sizeof(TET_MDS_MSG));
4739 memcpy(mesg->send_data, tmp, sizeof(tmp));
4740 mesg->send_len = sizeof(tmp);
4741
4742 printf("\nInside Receiver Thread\n");
4743 fflush(stdout);
4744 if ((svc_id = is_adest_sel_obj_found(0))) {
4745 printf("\n\t Got the message: trying to retreive it\n");
4746 fflush(stdout);
4747 sleep(1);
4751 printf("Fail mds_service_retrieve\n");
4752 }
4753 /*after that send a response to the sender, if it expects*/
4754 pthread_mutex_lock(&gl_mutex);
4755 rsp_reqd = gl_rcvdmsginfo.rsp_reqd;
4756 pthread_mutex_unlock(&gl_mutex);
4757 if (rsp_reqd) {
4760 mesg) != NCSCC_RC_SUCCESS) {
4761 printf("Response Fail\n");
4762 } else
4763 printf("Response Success\n");
4764 pthread_mutex_lock(&gl_mutex);
4766 pthread_mutex_unlock(&gl_mutex);
4767 }
4768 }
4769
4770 pthread_cleanup_pop(1);
4771}
4772
4774{
4775 MDS_SVC_ID svc_id;
4776 bool rsp_reqd = false;
4777 char tmp[] = " Hi Sender! My Name is RECEIVER ";
4778 TET_MDS_MSG *mesg;
4779 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
4780 pthread_cleanup_push(free, mesg);
4781 memset(mesg, 0, sizeof(TET_MDS_MSG));
4782 memcpy(mesg->send_data, tmp, sizeof(tmp));
4783 mesg->send_len = sizeof(tmp);
4784
4785 printf("\nInside Receiver Thread\n");
4786 fflush(stdout);
4787 if ((svc_id = is_vdest_sel_obj_found(1, 1))) {
4788 if (mds_service_retrieve(gl_tet_vdest[1].mds_pwe1_hdl,
4791 printf("Fail mds_service_retrieve\n");
4792 }
4793 /*after that send a response to the sender, if it expects*/
4794 pthread_mutex_lock(&gl_mutex);
4795 rsp_reqd = gl_rcvdmsginfo.rsp_reqd;
4796 pthread_mutex_unlock(&gl_mutex);
4797 if (rsp_reqd) {
4798 if (mds_send_response(gl_tet_vdest[1].mds_pwe1_hdl,
4800 mesg) != NCSCC_RC_SUCCESS) {
4801 printf("Response Fail\n");
4802 } else
4803 printf("Response Success\n");
4804 }
4805 }
4806
4807 pthread_cleanup_pop(1);
4808}
4809
4811{
4812 int FAIL = 0;
4814 void tet_adest_rcvr_thread();
4815
4816 char tmp[] = " Hi Receiver! What is your Name? ";
4817 TET_MDS_MSG *mesg;
4818 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
4819 memset(mesg, 0, sizeof(TET_MDS_MSG));
4820 memcpy(mesg->send_data, tmp, sizeof(tmp));
4821 mesg->send_len = sizeof(tmp);
4822
4823 /*Start up*/
4824 if (tet_initialise_setup(false)) {
4825 printf("\n\t Setup Initialisation has Failed \n");
4826 FAIL = 1;
4827 }
4828
4829 else {
4833 svcids) != NCSCC_RC_SUCCESS) {
4834 printf("\nFail\n");
4835 FAIL = 1;
4836 }
4840 printf("\nFail\n");
4841 FAIL = 1;
4842 }
4843 printf(
4844 "\nTest Case 1: Svc INTMIN on PWE=2 of ADEST sends a LOW Priority message to Svc NCSMDS_SVC_ID_EXTERNAL_MIN and expects a Response\n");
4845 /*Receiver thread*/
4849 printf("\nTask has been Created");
4850 fflush(stdout);
4851 }
4852 /*Sender*/
4857 mesg) != NCSCC_RC_SUCCESS) {
4858 printf("\nFail\n");
4859 FAIL = 1;
4860 } else
4861 printf("\nSuccess\n");
4862 /*Now Stop and Release the Receiver Thread*/
4865 printf("\tTASK is released\n");
4866 }
4867 fflush(stdout);
4871 svcids) != NCSCC_RC_SUCCESS) {
4872 printf("\nFail\n");
4873 FAIL = 1;
4874 }
4875
4876 /*clean up*/
4877 if (tet_cleanup_setup()) {
4878 printf("\nSetup Clean Up has Failed \n");
4879 FAIL = 1;
4880 }
4881 }
4882
4883 free(mesg);
4884 test_validate(FAIL, 0);
4885}
4886
4888{
4889 int FAIL = 0;
4891 void tet_adest_rcvr_thread();
4892
4893 char tmp[] = " Hi Receiver! What is your Name? ";
4894 TET_MDS_MSG *mesg;
4895 mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
4896 memset(mesg, 0, sizeof(TET_MDS_MSG));
4897 memcpy(mesg->send_data, tmp, sizeof(tmp));
4898 mesg->send_len = sizeof(tmp);
4899