11
㈜㈜㈜㈜㈜ TR-069 ㈜㈜㈜㈜㈜ ㈜㈜ ㈜㈜ 3 ㈜

TR 069 클라이언트 검토자료 3편

  • Upload
    ymtech

  • View
    338

  • Download
    3

Embed Size (px)

DESCRIPTION

TR-069 클라이언트 검토 자료3편 : 망에 붙어 있는 device들을 관리하기 위한 Protocol

Citation preview

Page 1: TR 069 클라이언트 검토자료 3편

㈜유미테크

TR-069 클라이언트검토 자료 3 편

Page 2: TR 069 클라이언트 검토자료 3편

2 ㈜유미테크 TR-069 클라이언트 검토 자료

Modus-TR-069- Activator

모든 번들은 Activator.java 존재 . 역할 : 서비스를 OSGi 서비스 레지스트리에 등록 RPCMethodMngService 는 서비스 & 번들 자체적으로 관리함 .

public final class Activator implements BundleActivator {

* Start. * @param context the context * @throws Exception the exception */ public void start(final BundleContext context) throws Exception { context.addServiceListener(new Scheduler(context, data)); data.setEventFile(context.getDataFile("Events.data")); context.registerService(RPCMethodMngService.class.getName(), RPCMethodMng.getInstance(), null); RPCMethodMng.getInstance().registerRPCMethod("Inform"); RPCMethodMng.getInstance().registerRPCDecoder("InformResponse", new InformResponseDecoder()); } /** * Stop. * @param context the context * @throws Exception the exception */ public void stop(final BundleContext context) throws Exception { RPCMethodMng.getInstance().unregisterRPCMethod("Inform"); RPCMethodMng.getInstance().unregisterRPCDecoder("InformResponse"); }

Page 3: TR 069 클라이언트 검토자료 3편

3 ㈜유미테크 TR-069 클라이언트 검토 자료

Modus-TR-069- Scheduler

Scheduler 는 TR069ClientAPI 번들의 Activator 를 통해 서비스 등록 . 번들 등록시 Scheduler 의 startTR69() 자동 동작함 . TR069 의 Periodic Inform 메시지 처리 Scheduler 임 .

private void startTR69() { if (checkState()) { Log.info("TR69Client is starting"); // allow discovers root of datamodel File conf = FileUtil.getFileFromShortName(FileUtil.CONFIG); if (conf != null) { InputStream in = null; try { Properties properties = new Properties(); // TODO ne pas passer par un fichier de properties in = new FileInputStream(conf); properties.load(in); data.setRoot(properties.getProperty("root")); } catch (Exception e) { e.printStackTrace(); } } Log.info("Root is " + data.getRoot()); // put the data model structure model.setData(data); putDefaultParameter(); Log.debug(data.toString());

// put data into data model Iterator it = data.getParameterIterator(); Parameter p; Object value; while (it.hasNext()) { p = (Parameter) it.next();

persist.restoreParameterNotification(p.getName()); persist.restoreParameterSubscriber(p.getName()); value = persist.restoreParameterValue(p.getName(), p.getType()); if (value != null) { p.setValueWithout(value); } } Log.info(data.toString()); com.setParameterData(data); com.setRPCMng(RPCMethodMng.getInstance()); it = data.getParameterIterator(); // save data model while (it.hasNext()) { p = (Parameter) it.next(); persist.persist(p.getName(), p.getAccessList(), p.getNoti-fication(), p.getValue(), p.getType()); } context.registerService(IParameterData.class.getName(), data, null); com.setRunning(true); new Thread(com, "Com Server").start(); ScheduleInform si = new ScheduleInform(data); si.initParameterSource(); si.createTask(); } else { if (com != null) { // stop the com to be clean when is restart com.setRunning(false); } } }

Page 4: TR 069 클라이언트 검토자료 3편

4 ㈜유미테크 TR-069 클라이언트 검토 자료

Modus-TR-069- Scheduler

new Thread(com, "Com Server").start() 으로 시작 객체명 com 은 ICom 인터페이스이며 이 구현체는 Com 에 구현

com 객체의 역할 TCP 및 UDP 소켓을 만들고 포트를 설정 ACS 서버에 접속하며 TR069 세션을 실행

Page 5: TR 069 클라이언트 검토자료 3편

5 ㈜유미테크 TR-069 클라이언트 검토 자료

- Com session = new TR69Session(parameterData, rpcMng, retry)

TR69Session ACS 서버에 접근해 Inform 을 보내며 받는 역할

Modus-TR-069

Page 6: TR 069 클라이언트 검토자료 3편

6 ㈜유미테크 TR-069 클라이언트 검토 자료

Modus-TR-069- 문제점

Inform 을 주고 받는지 확인 어려움 OSGi 의 서비스 형태의 구현상 어떠한 인폼을 보내고 받는지 확인 할 방법이 어려움

해결책 디버깅을 위해 실제 서버와 연동해 정상 케이스를 만들고 분석하는게 더욱 빠른

방법이라고 생각 오픈소스로 된 ACS 서버를 찾아 동작시켜 보고자 함

Page 7: TR 069 클라이언트 검토자료 3편

7 ㈜유미테크 TR-069 클라이언트 검토 자료

jCWMPServer 오픈소스

java 이면서 실제 소스를 받을 수 있도록 되어 있는 오픈소스 jCWMPServer (http://sourceforge.net/projects/jcwmpserver/) 이 적합

Page 8: TR 069 클라이언트 검토자료 3편

8 ㈜유미테크 TR-069 클라이언트 검토 자료

jCWMPServer 설치방법

ANT 로 build.xml 를 실행하여 컴파일된 파일을 만듬 . ( 빌드 타겟을 jar 로 하면 컴파일 및 환경 파일이 복사 .)

build 폴더의 serverSettings.xml 에 자신의 적합한 환경을 셋팅 .

DB 설정- DB 는 MySQL 환경으로 구성되어 있으며 주소 및 디비이름은 하드코딩 되어 있어 소스를 조금 수정 필요 .- server.Database.java 의 생성자에 사용자 및 패스워드 , 컨넥션 주소 존재- DB 스키마는 README 파일에 존재

실행java -jar ./build/jar/ProvisioningServer.jar

Page 9: TR 069 클라이언트 검토자료 3편

9 ㈜유미테크 TR-069 클라이언트 검토 자료

jCWMPServer 설치시 참고

소스에 script 폴더가 존재 . 쉘스크립트로 서비스를 실행하고 중지 시키는 스크립트 . 환경이 ping 사용자 및 그룹으로 되어 있어야 하고 컴파일된 파일이 /home/

ping/build/ 에 존재해야 함 . 이 스크립트를 사용해 보기 위해 환경을 만들어 실행 했지만 데몬 행태로 돌아가서

java -jar ./build/jar/ProvisioningServer.jar 명령어로 직접 실행 .

Page 10: TR 069 클라이언트 검토자료 3편

10 ㈜유미테크 TR-069 클라이언트 검토 자료

jCWMPServer Try 1

ACS 서버를 실행하고 TR069 클라이언트를 실행 . IOException 발생 . 클라이언트에서 Inform 을 보냈지만 서버에서 그대로 무시 .

해결 서버쪽 DB 의 box 및 model 테이블에 TR 클라이언트 환경을 추가해줌 .

Page 11: TR 069 클라이언트 검토자료 3편

11 ㈜유미테크 TR-069 클라이언트 검토 자료

jCWMPServer Try 2

첫번째 Inform 을 서로 주고 받음 . 클라이언트 쪽에서 GetParameterValues 부분에서 Invalid arguments 오류

발생 . 서버에서 널포인트 익셉션 발생 .

원인 서버에서 단말에 요청할 파라이터를 넣어서 주어야 하는데 요청할 파라미터가 없음 .

해결 해결중 ... 디비에 직접 요청할 파라미터를 넣으려고 했지만 서버쪽에서 정의하는 데이터라

정확히 입력이 불가 . 따라서 서버가 직접 값을 넣어주는 방식을 선택 . 소스를 보면 PHP 된 GUI 환경이 존재 . 서버를 제어하는 GUI 환경인것 같은데 이걸 설치해 ACS 서버 관리 화면을 띄우고

이곳에서 파라미터를 넣는 방식으로 해보고자 함 .